Tracing MovieClips Name

I am creating some MovieClips like so:

var AClip:A = new A();
var A2Clip:A2 = new A2();
var A3Clip:A3 = new A3();

I then put the above into an array and am trying to trace out thier "name".

for(var i:int=0;i<theArray.length;i++){
        trace(theArray[i].name);
    }

This traces

instance99
instance77
instanceN...

What I want to accomplish is the trace is tracing out what I "initialized" them to

AClip
A2Clip
A3Clip

Is there a way to do that? Thanks

Answers


Variable's name is not the same as MovieClip's name. You have to set its name manualy:

var AClip:A = new A();
var A2Clip:A2 = new A2();
var A3Clip:A3 = new A3();
AClip.name = "AClip";
A2Clip.name = "A2Clip";
A3Clip.name = "A3Clip";

Then you can get their name by calling trace(theArray[i].name);


Need Your Help

Nested ViewModel Dependent Methods don't work

javascript mvvm kendo-ui

I'm working on a data audit web applicaton which has a model containing several field sets composed of old value, new value, and current value fields. The current value is a calculated field (by KO

Swapping array elements in Javascript

javascript arrays

I have an array like this - (i do not know the length of this array in advance)

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.