Tutorials Home
What's New
Top Rated
Submit
myTutes
Random!
Variable variables in actionscript
Author: Mirza Hatipovic
Actionscript
With eval() you can achieve similar results in AS.
//my_var has a string value of “mirza”
my_var = “mirza”;
//allocate a variable variable of the variable my_var
mirza = 1;
//has a value of 1
trace(eval(my_var));
Well, I know that this looks very strange. But I use this method in loops to dynamically create variables like pic1, pic2, pic3.
for(i = 1; i<=5; i++){
//current variable
curr_var = eval(pic + '' + i);
//handle variable…pic1, pic1, etc
}
Hope you’ll find it usefull.
| » Level Advanced |
|
|
Added: : 2002-10-14
Rating: 7.03 Votes: 37
Hits: 1795
|
| » Author |
|
Mirza Hatipovic is freelance developer based in Bosnia and Hercegovina. He uses PHP, Flash, XML and ColdFusion to create dynamic web content.
|
| » Download |
|
Download the files used in this tutorial.
|
|
Download (1 kb)
|
|
Get conversion and unzipping tools
for PC and Mac here!
|
| » Forums |
|
More help? Search our boards for quick answers!
|
|
Please rate this tutorial, 10 is the top rating, you can also click the
comments link to read/write a review.
|
|
|