applicationComplete is the perfect solution for me.  

Here's my a code snippet for anyone reading this later:

[Bindable]public var _smAppLoaded:SystemManager;

<mx:SWFLoader id="myLoader" width="300"
        complete="onCompleteMyLoader();"/>

  private function onCompleteMyLoader():void {
      _smAppLoaded = SystemManager(myLoader.content);
 
_smAppLoaded.addEventListener(FlexEvent.APPLICATION_COMPLETE,onLoadedApp
licationComplete)
  }
  
  private function onLoadedApplicationComplete(oEvent:Event):void
  {
    Alert.show(_smAppLoaded.application["lblOne"].text);
  }

Tracy


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Alex Harui
Sent: Thursday, March 08, 2007 9:22 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] SWFLoader: WHEN can I access
SystemManager.application["myContent"]?

You should get an applicationComplete when the app's ready.  It is
available earlier than that, but I don't think there's a good event for
it.  You could check on enterFrame events.
 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Thursday, March 08, 2007 6:02 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] SWFLoader: WHEN can I access
SystemManager.application["myContent"]?
 
In a handler on the complete event of a SWFLoader, I set an instance
variable(typed as SystemManager)  to myLoader.content.
_smAppLoaded = SystemManager(myLoader.content);
When can I access the .application property?:
Alert.show(_smAppLoaded.application["lblOne"].text);
If I try it in the event handler, I get a null reference.
The same if I try it in a callLater()
But if I try it after a setInterval or timer of 5000 ms, I get a valid
reference.
And from a button in the UI, it is valid.
Is there a good way to know if it is ready?   Or should I just use a
timer loop?
Tracy
 

Reply via email to