flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simon gladman <sglad...@gmail.com>
Subject Re: Global Variables
Date Fri, 28 Mar 2014 09:57:19 GMT
Well, the best way of doing it is to use a framework like Parsley. This
gives you 'dependency injection' where you can inject a class into others -
for example you might share a model across all your classes.

The filthy way of doing it is to create a single globals class with all its
variables made static :)

Simon


On 28 March 2014 09:38, SmileySnr <liam.odonnell@dit.ie> wrote:

> Due to the size of the script area in the my main project  mxml file, I
> decided to break it up into several class files. One for each database
> table. I have adopted a crude mechanism to move data around from the mxml
> to
> the as scripts and between the as scripts. I have setup a class call
> Globals, with an instance called g, which contains all a copy of all the
> instance variables of the classes, Callresonder objects, datagrids etc.
>
> Resulting in 'g' being passed around every class in order to ensure the
> data
> is available where it is needed.
>
> I know I can create a new instance of the global variable within each
> class,
> NOT quite what I want.
>
> I would like to create the global variable in the main project mxml file
> and
> reference it in the class files ...
>
> Can this be done ?
>
>
>
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/Global-Variables-tp5815.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>



-- 
*flexmonkey.co.uk <http://flexmonkey.co.uk> | @FlexMonkey
<https://twitter.com/FlexMonkey> | +44 (0) 7973 669691*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message