Reputation: 2021
I would like to get the name of the elements in the library when this element is on the stage. If I can't I would like to get the name of "The AS3 link".
I tried with this code:
for (var i=0; i<this.numChildren; i++){
trace("Movie Name: "+this.getChildAt(i).name);
trace("Movie Class: "+getQualifiedClassName(this.getChildAt(i)));
trace("Movie Super Class: "+getQualifiedSuperclassName(this.getChildAt(i)));
}
But I only get this: Movie Name: instance1 Movie Class: flash.display::Bitmap Movie Class: flash.display::DisplayObject
Upvotes: 0
Views: 764
Reputation: 305
It is impossible to get the name from library. It is used only by the Flash IDE and it is not exported.
To get the class name from a bitmap in stage, you can try this:
var bitmapData:BitmapData = Bitmap(getChildAt(0)).bitmapData;
trace(getQualifiedClassName(bitmapData))
Upvotes: 1
Reputation: 6708
In you library there are three images. Linkage name of the image represents a BitmapData class. You can't add BitmapData directly to the stage. Firstly, you create a BitmapData instance:
var bitmapData:BitmapData = new SomeBitmapData();
SomeBitmapData it's a linkage name of the image.
Then you add an instance of Bitmap class:
var bitmap:Bitmap = new Bitmap(bitmapData);
addChild(bitmap);
If you want to get linkage name e.g. SomeBitmapData
you should write:
trace(getQualifiedClassName(bitmapData)); // SomeBitmapData
Upvotes: 0