Or make the Globals a singleton(ish) class, for ref. see [1]. All approaches are valid and depend on what you want to build and how maintainable it should be.
[1] http://www.swinburne.edu.au/design/tutorials/P-flash/T-How-to-build-a-Singleton-in-Actionscript-3/ID-143/ Martin On Fri, Mar 28, 2014 at 10:57 AM, simon gladman <sglad...@gmail.com> wrote: > 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.odonn...@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*