?
Solved

Finding Movieclips on timeline

Posted on 2011-03-15
4
Medium Priority
?
356 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 2000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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. …
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
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…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

719 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