I am so noob, don't know terms to search for

First, I want to apologize for posting this. I tried searching on a number of different terms, but I am so new to AS3, that I really don’t know what kind of terminology to user for this search. Simple problem. I have two movieclips on the stage, one named movieClip1, the other movieClip2. I then have a simple script that randomly picks one of the movieClips, and advances the selected movieclip to frame 2.

var _whichMovie =Math.ceil(Math.random()*2);
trace(_whichMovie);
var _movieName:String;
_movieName = “movieClip”+_whichMovie;
trace(_movieName);
MovieClip(_movieName).gotoAndStop(2);

I may be doing this totally wrong, since I haven’t really touched AS3 very much. I just want to reference an object already existing on the stage. I do not want to have to add the mc to the stage through AS3, since I will be giving this to people who have no idea how to script for maintentance. I think that my problem may have more to do with how AS3 handles movieclips on the stage than anything else. Thanks for any help.

try [_movieName].gotoAndStop(2);

Thanks for the quick reply. I tried what you suggested, and got a 1083: Syntax error: dot is unexpected. error.

Yeah sorry. I’m an idiot. Try this instead.

MovieClip(this.getChildByName(_movieName)).gotoAndStop(2);

Yeah, right, you are an idiot. What does that make me? This worked like a charm. I guess that the key here was getChildByName, which makes total sense. Thanks so much!

[quote=Iamthejuggler;2348540]Yeah sorry. I’m an idiot. Try this instead.

MovieClip(this.getChildByName(_movieName)).gotoAndStop(2);[/quote]