Quick Actionscript question.
- Started
- Last post
- 3 Responses
- motivdesign
Here's the deal:
I've got a bunch of movieclips, instance-named petal_1 through petal_72.
I need to pick one of them at random, and instruct it to Play. The random number is stored in a vaiable called "rand", and I'm creating a new variable called "targetClip" which is essentially "petal_" add rand to come up with a name that I can use to target a random clip.
But the problem comes when I attempt to play said clip as follows:
_root.targetClip.play();
Flash interprets "targetClip" literally instead of subbing in the variable. Does anyone know how I'd get around this?
- motivdesign0
Figured it out for anyone who might be curious. You can treat it like an array in any other scripting language, and call it like this:
_root[targetClip].play();
- neeko0
i thought i knew the answer to this, but when i tried it, sure enough it didnt work.
i know you can use an array and use:
yourarrayname[rand].play();
but im also sure theres an easier way.
- neeko0
ah.
super.