PDA

View Full Version : String conversion problem


nchagial
07-20-2005, 12:06 AM
Hello,

I ve got the following problem

I ve got several movieClips in the stage i.e. movie1, movie2, movie3, etc. and i want to call them using

which.gotoAndPlay(frameName);

, where "which" is the name of an instance of a movieClip each time.

I ve also got a value inc that increments from 1 to the number of movieClips and I want to call each one sequentially.

for (inc = 1; inc < movieClips; inc++)
{
which = movie + inc.toString();
which.gotoAndPlay(frameName);
}

however that doesn't seem to work.

Any suggestions? Thanks..

Ricod
07-20-2005, 01:30 AM
Welcome to AS[org] nchagial !

Try to place movie in quotes, like this :
for (inc = 1; inc < movieClips; inc++)
{
which = "movie" + inc.toString();
which.gotoAndPlay(frameName);
}
This would result in "movie1", "movie2", etc. If this is not what you want, you'll need to define the variable 'movie' then, otherwise it's value is null.

nchagial
07-20-2005, 04:53 PM
Thanks Ricod..

that was helpful, however i needed to call it as : _root[which].gotoAndPlay(frameName);

for (inc = 1; inc < movieClips; inc++)
{
which = "movie" + inc.toString();
_root[which].gotoAndPlay(frameName);
}