Newbie Flash Help
- Started
- Last post
- 4 Responses
- stimuli
Hawo! Hoping one of you folks can help here, I can't get this to work. Just reading Colin Moock's book and starting to learn Actionscript.
Working on a Flash piece at the moment that has 41 movieclips on the stage, each one an animation. Each clip has an instance name of lbClip1, lbClip2 etc, up to lbClip41. The main piece of code creates a new array (lbClipNos) and stores 41 unique random numbers between 1 and 41 then appends that number to the string "lbClips", thus creating a reference to a movieclip instance.
Thing is, none of the animations will play when I tell them to and it's got something to do with this piece of code:
for (n = 0; n < lbClipNos.length; n++) {
whichClip = "lbClip" + lbClipNos[n];
whichClip.gotoAndPlay(2);
}Any suggestions as to what's wrong? It's driving me mad.
- unknown0
You might want to use eval( with you string in here)... Might be something like that.
- ********0
where is the mighty unfittoprint, he knows for sure! :)
- unfittoprint0
as Engage said, you must eval dat mutha...
you're almost there. Where you wrote:
whichClip = "lbClip" + lbClipNos[n];
should be:
whichClip = this["lbClip" + lbClipNos[n]]
or
whichClip = "lbClip" + lbClipNos[n];
whichClip = this[whichClip]
- stimuli0
Thanks chappies, tis now working a treat... well almost... now I need to fit in setInterval somewhere.