Solved

using loop to access instance of a movie clip[

Posted on 2011-02-28
3
366 Views
Last Modified: 2012-05-11

I have movieclip in library which is being added to the stage. It has many smaller clips which are already named a1-a2-a3....

How can I access to them using a loop?

Using AS3
0
Comment
Question by:Angha110
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
ute_arbeit earned 500 total points
ID: 35002276
You can use the getChildByName () method of DisplayObjectContainer class (base class of MovieClip):

var numClips:int = mc.numChildren;
var child:DisplayObject;
for (var i:int = 1; i <= numClips; i++) {
	child = mc.getChildByName ("a" + i);
	...
}

Open in new window

0
 

Author Comment

by:Angha110
ID: 35002645
Great, I just did a test and I can trace the numChildren correctly. Now, what I need is to call the right instance to play the moviecliep.

mc.a11.play();

it gives me error.
Each movie clip has 10 frame inside and I have stop(0 on the first frame. the play() will play the movieclip.
0
 

Author Comment

by:Angha110
ID: 35002931
Hey, Thank you for the tip. I used an array to hold my clips and all works fine.
Thank you again.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

762 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

19 Experts available now in Live!

Get 1:1 Help Now