If you need this thing to be done right at startup you can consider a static method like we’ve recommended in the past to make a faceless object an event dispatcher.

 

<mx:Script>

  public static var foo:String;

  static function initGlobal():Boolean

  {

    foo = someValue;

    return true;

  }

  private static staticsInited : Boolean = initGlobal();

</mx:Script>

 

Now you can refer to this property as MyApplication.foo (note MyApplication is the name of your MXML file).

 

You can also just use a singleton somewhere to hold onto your globals, not everything has to hang off of Application.application.

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Clint Modien
Sent: Wednesday, July 20, 2005 7:58 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] initializing global variables

 

The behavior is apparently by default..

http://livedocs.macromedia.com/flex/15/flex_docs_en/00000505.htm

On 7/20/05, JesterXL <[EMAIL PROTECTED]> wrote:

Is their creationPolicy not set to "all"?

 

----- Original Message -----

From: Clint Modien

Sent: Wednesday, July 20, 2005 10:12 AM

Subject: Re: [flexcoders] initializing global variables

 

Ya i did try to use the initialize handler... but apparently it get's called "after" the initialize handler of my grandchild.

Check the link.

On 7/20/05, Sauro, Nick <[EMAIL PROTECTED]> wrote:

Well, your parent won't be fully created until its children are, since the children are its data members, so how can the parent be 'completed', w/o its data/members/children being completed first?

 

As for your global vars, have you tried using the initialize handler?

 

 

 

Nick Sauro + R O U N D A R C H + bus 212.909.2335 + mob 914.882.3687

 

 


From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com] On Behalf Of Clint Modien
Sent: Wednesday, July 20, 2005 9:53 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] initializing global variables

OK so umm...

http://livedocs.macromedia.com/flex/15/flex_docs_en/00000505.htm

I'm confused.

My grandkids and my kids get initialized before I do? (The application)

Uhh... how am I supposed to setup the any global vars in the app?

Even the creationCompletes of my grandkids fires before the app does.


What's the first event to fire in the Application that I can use to initialize a global var?

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com



YAHOO! GROUPS LINKS

 

 





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com



YAHOO! GROUPS LINKS

 

 






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to