all groups > flash actionscript > september 2005 >
You're in the

flash actionscript

group:

Script Newbie needs help =]


Script Newbie needs help =] =Slayer=
9/22/2005 11:08:51 PM
flash actionscript:
I made a MC which is stopped at the first frame. The MC is duplicated 20 times.
They are named s1 to s20. I want one of the MC's to start playing randomly. I
put this code in:

mcToPlay = "s" add (Math.round(Math.random()* 20));
_root.bg.mcToPlay.play();

I checked the variable mcToPlay with the debugger and it creates correct
values. However, the second line of the code doesn't do what it's supposed to.
I'm sure the path to the movie clip is correct.

Anny suggestions?
Pemo

Re: Script Newbie needs help =] NSurveyor
9/22/2005 11:15:11 PM
When you trace mcToPlay, what you're getting is a STRING, not a MOVIECLIP.
Also, _root.bg.mcToPlay doesn't exist, it's mcToPlay which exists. The way you
can fix this, is using Bracket notation:

_root.bg[mcToPlay].play();
Re: Script Newbie needs help =] mcwelch16
9/22/2005 11:15:32 PM
change _root.bg.mcToPlay.play(); to _root.bg[mcToPlay].play();

Re: Script Newbie needs help =] =Slayer=
9/22/2005 11:18:33 PM
Thank you very much!

Re: Script Newbie needs help =] NSurveyor
9/22/2005 11:24:26 PM
Re: Script Newbie needs help =] mandingo
9/22/2005 11:44:59 PM
and the "add" operator went out with Flash 4.

Re: Script Newbie needs help =] NSurveyor
9/22/2005 11:48:51 PM
To be more precise:

Re: Script Newbie needs help =] mandingo
9/22/2005 11:52:01 PM
yeah yeah tamatees tomatoes...

AddThis Social Bookmark Button