[Flashcoders] Dynamic access of top-level variables in AS3
Maybe I'm missing something, but I don't see how I can dynamically reference variables passed via a GET string into the swf using this. Hello :) in AS3 you use directly variables in global when you use a new .as ! package { static globalVariable = {} ; // your in topLevel !!! public class MainClass() { // first code in your Application // load your xml and use your global variable !!! } } EKA+ :) ___ 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
Re: [Flashcoders] Dynamic access of top-level variables in AS3
or what about stage[myVar] Charles P. On 7/11/06, Charles Parcell [EMAIL PROTECTED] wrote: this[myVar] doesn't work?? Charles P. On 7/11/06, Chris McFadyen aka Grayson Carlyle [EMAIL PROTECTED] wrote: Maybe I'm missing something, but I don't see how I can dynamically reference variables passed via a GET string into the swf using this. Hello :) in AS3 you use directly variables in global when you use a new .as ! package { static globalVariable = {} ; // your in topLevel !!! public class MainClass() { // first code in your Application // load your xml and use your global variable !!! } } EKA+ :) ___ 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
[Flashcoders] Dynamic access of top-level variables in AS3
flash.display.Stage is a sealed class and can't contain swf-passed variables. QUOTE or what about stage[myVar] Charles P. ___ 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
Re: [Flashcoders] Dynamic access of top-level variables in AS3
Create an object in the global scope to contain your variables, let's call it _global. Then reference it as: _global[myVar]; Or if you don't like the idea of a global object, create a dynamic class to do the same. Derek Vadneau - Original Message - From: Chris McFadyen aka Grayson Carlyle [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Tuesday, July 11, 2006 11:31 AM Subject: [Flashcoders] Dynamic access of top-level variables in AS3 flash.display.Stage is a sealed class and can't contain swf-passed variables. QUOTE or what about stage[myVar] Charles P. ___ 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
Re: [Flashcoders] Dynamic access of top-level variables in AS3
Hello :) in french : http://www.ekameleon.net/blog/index.php?2006/07/06/35--as3-le-_global-bien-cache- EKA+ :) 2006/7/11, Derek Vadneau [EMAIL PROTECTED]: Create an object in the global scope to contain your variables, let's call it _global. Then reference it as: _global[myVar]; Or if you don't like the idea of a global object, create a dynamic class to do the same. Derek Vadneau - Original Message - From: Chris McFadyen aka Grayson Carlyle [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Tuesday, July 11, 2006 11:31 AM Subject: [Flashcoders] Dynamic access of top-level variables in AS3 flash.display.Stage is a sealed class and can't contain swf-passed variables. QUOTE or what about stage[myVar] Charles P. ___ 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 ___ 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
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. On 7/11/06, Derek Vadneau [EMAIL PROTECTED] wrote: Create an object in the global scope to contain your variables, let's call it _global. Then reference it as: _global[myVar]; Or if you don't like the idea of a global object, create a dynamic class to do the same. Derek Vadneau ___ 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
Re: [Flashcoders] Dynamic access of top-level variables in AS3
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
Re: [Flashcoders] Dynamic access of top-level variables in AS3
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
Re: [Flashcoders] Dynamic access of top-level variables in AS3
Hi, You may want to check out flash.display.LoaderInfo[1]. It has a property parameters that has all the variables passed to the swf via querystring and flashvars. The DisplayObject at the top of the display list will have a loaderInfo property with an instance of the LoaderInfo class. Hope this helps. [1] http://livedocs.macromedia.com/flex/2/langref/flash/display/LoaderInfo.html#parameters On 7/10/06, Chris McFadyen aka Grayson Carlyle [EMAIL PROTECTED] wrote: In doing web apps, we pass a lot of variables directly to the swf files. ___ 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
Re: [Flashcoders] Dynamic access of top-level variables in AS3
That's the one! Thanks :D On 7/11/06, Juan Anorga [EMAIL PROTECTED] wrote: Hi, You may want to check out flash.display.LoaderInfo[1]. It has a property parameters that has all the variables passed to the swf via querystring and flashvars. The DisplayObject at the top of the display list will have a loaderInfo property with an instance of the LoaderInfo class. Hope this helps. [1] http://livedocs.macromedia.com/flex/2/langref/flash/display/LoaderInfo.html#parameters On 7/10/06, Chris McFadyen aka Grayson Carlyle [EMAIL PROTECTED] wrote: In doing web apps, we pass a lot of variables directly to the swf files. ___ 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
[Flashcoders] Dynamic access of top-level variables in AS3
In doing web apps, we pass a lot of variables directly to the swf files. Some of these are dynamically matched using eval() to write variable values into strings. Example: Reading settings from an XML file, with %var% in the node values; we search for for these and match up %var% to eval(var). Without using eval(), _root[var] would've worked, but _root is gone in AS3 as well. Is there some other method I can use in AS3 to access top-level variables dynamically? ___ 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
Re: [Flashcoders] Dynamic access of top-level variables in AS3
Hello :) in AS3 you use directly variables in global when you use a new .as ! package { static globalVariable = {} ; // your in topLevel !!! public class MainClass() { // first code in your Application // load your xml and use your global variable !!! } } EKA+ :) 2006/7/10, Chris McFadyen aka Grayson Carlyle [EMAIL PROTECTED]: In doing web apps, we pass a lot of variables directly to the swf files. Some of these are dynamically matched using eval() to write variable values into strings. Example: Reading settings from an XML file, with %var% in the node values; we search for for these and match up %var% to eval(var). Without using eval(), _root[var] would've worked, but _root is gone in AS3 as well. Is there some other method I can use in AS3 to access top-level variables dynamically? ___ 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