Except for course that any variables you write on the stage aren't available inside classes...
I guess the solution would be to figure out what 'this' is on the stage. Doing trace(this); gives [object Timeline0_f07ac19cdfe1944b8711232f8d557a] (with a different hash every time). This isn't the flash.display.Stage object... anyone know what it is? On 7/11/06, Chris McFadyen aka Grayson Carlyle <[EMAIL PROTECTED]> wrote:
Aha! The solution is to have the global object on the stage AS code: var global = this; Simple enough, but I was always trying to do it within an as file: package { var global = this; class MyClass() { } } Which will cause a compile error for referencing "this" outside of a class. Thanks guys. On 7/11/06, Derek Vadneau <[EMAIL PROTECTED]> wrote: > > No, you don't need to know the name of the variable. "myVar" isn't the > name of the variable, it's a variable that holds the name of the > variable. > > So: > function getVar(myVar) > { > return _globla[myVar]; > } > > getVar("variableDelta"); > > > You need to know the variable name at some point to create it and to > address it. That is, your class doesn't need to know, but at some point > in > code a variable name is known, whether it's generated with a string > concatenation or passed from another SWF/app/browser/etc. > > Does that address your situation? If not, maybe you could explain how > you > want to use it? > > > Derek Vadneau > > ----- Original Message ----- > From: "Chris McFadyen aka Grayson Carlyle" <[EMAIL PROTECTED]> > To: "Flashcoders mailing list" < flashcoders@chattyfig.figleaf.com> > Sent: Tuesday, July 11, 2006 11:50 AM > Subject: Re: [Flashcoders] Dynamic access of top-level variables in AS3 > > > That however requires putting those variables into the global object > (which > I don't have a problem with), but I don't know the names of these > variables... that's why I need dynamic variable references. > > > > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com >
_______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com