all groups > flash actionscript > december 2004 >
You're in the

flash actionscript

group:

syntax problem (variable within a variable)


syntax problem (variable within a variable) (_seb_)
12/7/2004 11:22:26 PM
flash actionscript:
Hi

I want to tell flash that

$mcPath = "_root[$toolOrStage].reTollContent.textToolBox";

where $toolOrStage is also a variable.
I'm not sure why it doesn't work.

Maybe because being between quotes, flash doesn't evaluate what
toolOrStage should be in the string? But without quotes,

$mcPath = _root[toolOrStage].reTollContent.textToolBox;

doesn't work either.

Re: syntax problem (variable within a variable) Jan-Paul K.
12/8/2004 8:52:00 AM
did you try this one:
$mcPath = "_root["+$toolOrStage+"].reTollContent.textToolBox";
or:
$mcPath = "_root['"+$toolOrStage+"'].reTollContent.textToolBox";
or:
$mcPath = "_root."+$toolOrStage+".reTollContent.textToolBox";

btw: why are you using those "$" for you variable names anyway? flash does not
require this kind of vairable declaration.

Regards,
Paul
Re: syntax problem (variable within a variable) ilogik
12/8/2004 12:13:01 PM
if u r passing somevalue to ur var macPath, then try using., mcPath =
eval(_root[toolOrStage].reTollContent.textToolBox); mcPath =
eval(_root.toolOrStage.reTollContent.textToolBox); or else what Jan-Paul K.
suggest was perfect and u dont need '$' sign in flash its of no use.
AddThis Social Bookmark Button