Actionscript 3 Movieclip Reference

Posted on 2011-02-15
Last Modified: 2012-05-11
Possibly lame question...

Let's say I have 7 movieclips...named something like:


Then I have a script that iterates from 1 to 10...  Let's say:

for (var f:Number=1; f<=10;f++){

As the script iterates up - I want to use that count number to reference the movieclip.


movieclip[f].x = 500;

What is the proper syntax for referencing the movieclip in that loop?
Question by:erzoolander
LVL 37

Accepted Solution

CyanBlue earned 500 total points
ID: 34899546
You'd do something like this...

var _mc:MovieClip;
for (var i:int = 1 ; i <= 10 ; i++)
   _mc = getChildByName("MovieClip" + i + "_mc");
   _mc.x = 500; 

Open in new window


Author Closing Comment

ID: 35098679
Gracias :)

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now