Solved

Finding Movieclips on timeline

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
Adobe Flash Free Transform Tool 2 148
How to determine issues pulling up internal device in browser. 5 96
You Tube Videos not playing 9 134
Create animated movies for web page 18 118
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…
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
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 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…

735 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