Solved

Finding Movieclips on timeline

Posted on 2011-03-15
4
351 Views
Last Modified: 2012-05-11
Hi

I was trying to find out all the Movie Clips on the stage.

Below code does not work in AS3

Any ideas?

Thanks

RG
var myArray:Array = new Array();

for (var prop in this) {
 if (this[prop] is MovieClip) {
  myArray.push(this[prop]);
  trace("myArray > " + myArray);
 }
}

Open in new window

0
Comment
Question by:rgarimella
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 2

Expert Comment

by:nycynik
ID: 35142800
var myArray:Array = new Array();

for (var xIndex=0; xIndex<this.numChildren; xIndex++)
{
      var prop = getChildAt(xIndex);
      if (prop is MovieClip) {
            myArray.push(prop);
              trace("myArray > " + myArray);
      }
}

thats it.
0
 
LVL 2

Accepted Solution

by:
nycynik earned 500 total points
ID: 35142807

just as code.

var myArray:Array = new Array();

for (var xIndex=0; xIndex<this.numChildren; xIndex++)
{
	var prop = getChildAt(xIndex);
	if (prop is MovieClip) {
		myArray.push(prop);
  		trace("myArray > " + myArray);
	}
}

Open in new window

0
 

Author Comment

by:rgarimella
ID: 35148031
I am getting results like this

myArray > [object MovieClip],[object btn03_5],[object btn02_8],[object btn01_10],[object MovieClip]

What do I need to do to get the Instance Name of the MovieClip into the array?
0
 
LVL 2

Expert Comment

by:nycynik
ID: 35150625
you have the object in the array, to get the movie clip name, use this:

prop.name
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

623 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