RE: [flexcoders] SWFLoader: WHEN can I access SystemManager.application[myContent]?

2007-03-09 Thread Tracy Spratt
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
 


RE: [flexcoders] SWFLoader: WHEN can I access SystemManager.application[myContent]?

2007-03-09 Thread Brian Holmes
I've listened for the SystemManager.applicationComplete event before to
get a valid reference to it.
 
 
b..



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Thursday, March 08, 2007 7: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

 


***
The information in this e-mail is confidential and intended solely for the 
individual or entity to whom it is addressed.  If you have received this e-mail 
in error please notify the sender by return e-mail delete this e-mail and 
refrain from any disclosure or action based on the information.
***


RE: [flexcoders] SWFLoader: WHEN can I access SystemManager.application[myContent]?

2007-03-08 Thread Alex Harui
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