Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variables from variables 1

Status
Not open for further replies.

ThomasJSmart

Programmer
Sep 16, 2002
634
iv got a variable issue :)

i want this to work:

name = "test"
name2 = name+1

//trace(name2) returns "test1"

now i want to use the content of name2 as the name of a new variable.
????? = "test3"

//trace(test1) should return "test3"

is this possible in flash?
or should i look for another solution?

im trying to make a function in flash that gets passed a name var, this name var is used to make some other vars and objects.

any help apreciated
Thomas



I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
 
Code:
name = "test";
name2 = name+1;
trace(name2); // returns "test1"
/*
now i want to use the content of name2 as the name of a new variable.
????? = "test3"
*/
//trace(test1) should return "test3"

_level0[name+1] = "test3";
//Or...
_level0[name2] = "test3";

trace(test1);
 
excelent! thank you :)

I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top