Hi Sudhakar,

You have a few ways to resolve this.

1) Try overloading the childrenCreated function as shown in the link
that I suggested u.
2) Append the parameters to ur base application ( the one that loads
the external swf). These parameters must be accessible to the loaded
swf application.
3) Explicitly (Manually) set the parameters to the loaded swf after it
loads.

The code for the first option is already in the link provided. For the
code for the remaining 2 options refer this link

http://stackoverflow.com/questions/407858/passing-flashvars-style-parameters-to-a-loaded-swf

***Learn to Google ... its as essential as breathing for developers ;)
***

On Apr 29, 9:13 pm, Sudhakar Kilaparti <[email protected]> wrote:
> Hi Kronos,
>
> I tried with the give URL it did't work to me. :(
>
> *my ExternalSWFLoader.mxml code:*
>
> <mx:SWFLoader source = "msrSelectedQuestion.swf?data_file=map/senate.xml"
> id="mapLoader" width="300" height="100" />
>
> *my msrSelectedQuestion.mxml code:*
>
> <?xml version="1.0" encoding="utf-8"?>
> <!-- wrapper/ApplicationParameters.mxml -->
> <s:Application
> xmlns:fx="http://ns.adobe.com/mxml/2009";
> xmlns:mx="library://ns.adobe.com/flex/mx"
> xmlns:s="library://ns.adobe.com/flex/spark"
> initialize="init(event)"
> width="980" height="460"
>
>  <fx:Script>
> <![CDATA[
> import mx.controls.Alert;
> import mx.events.FlexEvent;
>  [Bindable] private var sQuestionId:String;
>  private function init(evt:FlexEvent):void{
>  var your_param:String = this.loaderInfo.parameters.data_file;
> Alert.show(your_param);
>  }
>  ]]></fx:Script>
>  <s:HGroup top="50" left="100">
> <s:Label text="Question: "/>
> <s:Label text="{sQuestionId}" fontWeight="bold"/>
> </s:HGroup>
> </s:Application>
>
> *I am getting this error:*
>
> TypeError: Error #1009: Cannot access a property or method of a null object
> reference.
> at
> msrSelectedQuestion/init()[C:\xampp\htdocs\NGSPResize2\src\msrSelectedQuestion.mxml:21]
> at
> msrSelectedQuestion/___msrSelectedQuestion_Application1_initialize()[C:\xampp\htdocs\NGSPResize2\src\msrSelectedQuestion.mxml:9]
> at flash.events::EventDispatcher/dispatchEventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at
> mx.core::UIComponent/dispatchEvent()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\core\UIComponent.as:12977]
> at mx.core::UIComponent/set
> processedDescriptors()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\core\UIComponent.as:1810]
> at
> mx.core::UIComponent/initializationComplete()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\core\UIComponent.as:7556]
> at
> mx.core::UIComponent/initialize()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\core\UIComponent.as:7535]
> at
> spark.components::Application/initialize()[E:\dev\hero_private_beta\frameworks\projects\spark\src\spark\components\Application.as:1025]
> at msrSelectedQuestion/initialize()
> at
> mx.managers.systemClasses::ChildManager/childAdded()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\managers\systemClasses\ChildManager.as:189]
> at
> mx.managers.systemClasses::ChildManager/initializeTopLevelWindow()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\managers\systemClasses\ChildManager.as:359]
> at
> mx.managers::SystemManager/initializeTopLevelWindow()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\managers\SystemManager.as:2913]
> at 
> mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::kickOff()[E
> :\dev\hero_private_beta\frameworks\projects\framework\src\mx\managers\SystemManager.as:2730]
> at 
> mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::preloader_completeHandler()[E
> :\dev\hero_private_beta\frameworks\projects\framework\src\mx\managers\SystemManager.as:2610]
> at flash.events::EventDispatcher/dispatchEventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at
> mx.preloaders::Preloader/timerHandler()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\preloaders\Preloader.as:539]
> at flash.utils::Timer/_timerDispatch()
> at flash.utils::Timer/tick()
>
> *so please help me how to resolve it.*
>
>
>
> On Fri, Apr 29, 2011 at 5:57 PM, Kronos <[email protected]> wrote:
> > Hi,
>
> > You need to check out flashvars .... Just read this link
>
> >http://www.actionscript.org/forums/showthread.php3?t=175951
>
> > On Apr 29, 3:59 pm, Sudhakar <[email protected]> wrote:
> > > Hi all
>
> > >            i sticked with one problem anybody please give me solution.
>
> > > My Targets:
>
> > >  1) Loading external "SelectedQuestion.swf " (which is its own
> > > functionality) with some parameters ( like ?QuestionId=56 )into flex
> > > application.
>
> > > My sucess:
>
> > >    1) able to load external SelectedQuestion.swf  into flex
> > > application using <mx:SWFLoader />.
>
> > > My fails:
>
> > >   1) grabbing loaded SelectedQuestion.swf parameters (?QuestionId=56 )
> > > from external SelectedQuestion.swf.
>
> > > Source codes:
>
> > > SelectedQuestion.swf code:
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <!-- wrapper/ApplicationParameters.mxml -->
> > > <s:Application
> > >         xmlns:fx="http://ns.adobe.com/mxml/2009";
> > >         xmlns:mx="library://ns.adobe.com/flex/mx"
> > >         xmlns:s="library://ns.adobe.com/flex/spark"
> > >         creationComplete="initVars()"
> > >         width="980" height="460"
>
> > >         <fx:Script><![CDATA[
> > >                 import mx.controls.Alert;
> > >                 import mx.core.FlexGlobals;
> > >                 [Bindable]
> > >                 public var iQuestionId:String;
> > >                 private function initVars():void {
> > >                         iQuestionId =
> > > FlexGlobals.topLevelApplication.parameters.QuestionId;
> > >                 }
> > >         ]]></fx:Script>
> > >         <s:HGroup top="50" left="100">
> > >                 <s:Label text="Question: "/>
> > >                 <s:Label text="{iQuestionId}" fontWeight="bold"/>
> > >         </s:HGroup>
> > > </s:Application>
> > > -------------------
> > > Main Flex application code:
> > > <mx:SWFLoader x="240" y="122" source="SelectedQuestion.swf?
> > > QuestionId=56" />
> > > -----------------------------
>
> > > Please give me a better solution for this issue..
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Flex India Community" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/flex_india?hl=en.
>
> --
> Thanks & Regards:
> **************************
> Sudhakar K.
> +91 94 930 150 22http://www.satyar.com

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to