could you please {{please}} elaborate a little bit more...

Her'es my mx:Application

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
autoLayout="true" layout="vertical" 
        creationComplete="openWin()"
        horizontalScrollPolicy="off" verticalScrollPolicy="auto"
        height="100%" width="100%"
        xmlns:flexlib="http://code.google.com/p/flexlib/";
        paddingTop="0" paddingBottom="0" x="0" y="0"
        xmlns:local="*" 
        xmlns:com="com.*"
        applicationComplete="initApp()"
>

       public function initApp():void{
                //vkey=Application.application.parameters.vkey;
                vkey=this.parameters.vkey;
            //channel=Application.application.parameters.channel; 
            channel=this.parameters.channel;
        }



                public function openWin():void{
                        if(vkey!=null && vkey!=""){
                                openVideo();
                                isViewOpen = true;
                        } else if(channel!=null && channel!=""){
                                openChannels();
                                isChannelOpen = true;
                        } else if(!isOpen) {
                                openMain();
                                isOpen = true;
                        }


I now believe that the race condition is between initApp() and
openWin() How do I circumvent that ?

Rohan

--- In flexcoders@yahoogroups.com, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> If your script block looks like that, then you're assigning compon1 and
> component2 at instantiation time.  Properties are generally not
> available until later so I'd do the assignment in commitProperties or
> the initialize event.
> 
>  
> 
> -Alex
> 
>  
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Rohan Pinto
> Sent: Monday, June 04, 2007 8:57 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] loading mxml components based on flashvars
> 
>  
> 
> Hi Folks,
> 
> I'm passing component ID's into my app using flashvars.
> 
> in my main Application, I procure the values as follows:
> [Bindable]
> public var component1:String;
> 
> [Bindable]
> public var component2:String;
> component1=this.parameters.component1;
> component2=this.parameters.component2;
> 
> in the function as defined in my main Application : 
> creationComplete="openWin()"
> 
> I have the following:
> public function openWin():void{
> if(component1!=null||component1!=""){
> openComponent1(); 
> } else if(component2!=null||component2!=""){
> openComponent2(); 
> } else {
> openMain(); 
> }
> 
> the behaviour i see using this method is that everytime I load the
> application (regardless of the flashvars) it always loads Component1.
> 
> What am I doing wrong here ?
> Please advise...
> 
> Rohan
> http://opentube.info <http://opentube.info>
>


Reply via email to