You wouldn't be able to use the variable names x and y like this because
an Application inherits from DisplayObject which already has x and y
properties (implemented as getter/setters).

Also, such variables wouldn't technically be "global vars"; they'd be
"Application instance vars". But you can access them from any component
using Application.application.foo so they're kind of global-y in that
sense.

- Gordon


-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Matt Horn
Sent: Sunday, April 09, 2006 9:51 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] BETA 2: Setting global Vars at
creationComplete

You declare them as public outside a function in your app root and then
set their values in a function that is triggered off of the
application's creationComplete event. Pseudocode:

<mx:Application creationComplete="initVars()">
        <mx:Script>
                public var x:myVarX;
                public var y:myVarY;

                public function initVars():void {
                        // set values here
                }
        </mx:Script>

Hth,

Matthew J. Horn
Flex docs



> -----Original Message-----
> From: flexcoders@yahoogroups.com 
> [mailto:[EMAIL PROTECTED] On Behalf Of Alexander Tsoukias
> Sent: Friday, April 07, 2006 8:16 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] BETA 2: Setting global Vars at creationComplete
> 
> Hi all,
> 
> Simple question which I can't seem to find in the help section either.
> 
> I want to set some variables on creationComplete of my app so 
> that I can access them from anywhere in the rest of the 
> application later on or even change them as the user logs in 
> for example.
> 
> I'm a coldfusion expert, not an actionsript fan, but I'm 
> starting to like it very much, so bare with me on this one.
> 
> Thanks,
> Alex
> 
> 
> 
> 
> 
> 
> --
> 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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to