Global Variables

24 views
Skip to first unread message

manju100

unread,
Oct 30, 2007, 7:21:45 AM10/30/07
to Flex India Community
hello in my project i have many "title windows" i have many varialbes
used all over the application. they need to be global varialbe, the
value of thos can get changed in any of the title windows.

unfortunately i dont see a proper method to do this, i searched net
and ended with using singleton calss. its easy to use when i have 1 or
2 global variable, but in my project the global variables are number
more than 100

is there any way to declare global variables??

Abdul Qabiz

unread,
Oct 30, 2007, 8:07:01 AM10/30/07
to flex_...@googlegroups.com
It's not good practice to have global-variables (there might be garbage collection issues). However, you can define variables in Application and access it anywhere using mx.core.Application.application.varName

Does that make sense?

-abdul
--
-abdul
---------------------------------------
http://abdulqabiz.com/blog/
---------------------------------------

manju100

unread,
Oct 30, 2007, 8:21:13 AM10/30/07
to Flex India Community
thnaks abdul

yes, that solves my problem, yeh i know about garbage collection
issue, but my screen are like few computation will take place in one
screen and the results are used in some othere screen, like this i
have more than 10 to 20 screens so its difficult to avoid global
variables.

thanks for help


On Oct 30, 5:07 pm, "Abdul Qabiz" <abdul.qa...@gmail.com> wrote:
> It's not good practice to have global-variables (there might be garbage
> collection issues). However, you can define variables in Application and
> access it anywhere using mx.core.Application.application.varName
>
> Does that make sense?
>
> -abdul
>

> On 10/30/07, manju100 <manjunat...@gmail.com> wrote:
>
>
>
>
>
>
>
> > hello in my project i have many "title windows" i have many varialbes
> > used all over the application. they need to be global varialbe, the
> > value of thos can get changed in any of the title windows.
>
> > unfortunately i dont see a proper method to do this, i searched net
> > and ended with using singleton calss. its easy to use when i have 1 or
> > 2 global variable, but in my project the global variables are number
> > more than 100
>
> > is there any way to declare global variables??
>
> --
> -abdul
> ---------------------------------------http://abdulqabiz.com/blog/

> ---------------------------------------- Hide quoted text -
>
> - Show quoted text -

mrinal wadhwa

unread,
Oct 30, 2007, 8:44:44 AM10/30/07
to flex_...@googlegroups.com
You should ideally be using events.
_
Mrinal

> --------------------------------------- http://abdulqabiz.com/blog/

Abdul Qabiz

unread,
Oct 31, 2007, 4:34:45 AM10/31/07
to flex_...@googlegroups.com
Yup! Events or Singleton class.... So you are not polluting the global space (Scope)... Rather keep all that in a object, which you can delete or unreferenced..

-abdul
Reply all
Reply to author
Forward
0 new messages