| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Nov 2009
Posts: 2
|
Hi all, first time posting, long time lurker. Thanks for the great forum.
I'm curious if there is dynamic naming for variables, arrays, functions and whatnot in AS3. Below are Perl examples of what I'm asking about. It should be pretty explanatory. Thanks again, Doug $varOne = 'dog'; $varTwo = 'cat'; @arrayOne = ('dog','cat'); @arrayTwo = ('fish','frog'); sub subOne { print "anything"; } sub subTwo { print "anything else"; } $varDyn = 'One'; print ${'var'.$varDyn}; #result = dog &{'sub'.$varDyn}; #result = anything print ${'array'.$varDyn}[1]; #result = cat ${'varTest'} = 'bird'; print $varTest; #result = bird |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Mar 2003
Location: portugal
Posts: 228
|
hi,
In ActionScript you have array notation: ActionScript Code:
Last edited by nunomira; 11-07-2009 at 08:57 PM.. |
|
|
|
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Mar 2003
Location: portugal
Posts: 228
|
If you have a DisplayObject on the stage, you can also use getChildByName():
ActionScript Code:
|
|
|
|
|
|
#4 |
|
Registered User
Join Date: Nov 2009
Posts: 2
|
Thanks a bunch nunomira, that will help a lot.
Doug |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|