Solved

Finding Movieclips on timeline

Posted on 2011-03-15
4
308 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
  • 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

758 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

20 Experts available now in Live!

Get 1:1 Help Now