0

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".

enter image description here

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

Benoît Freslon
  • 2,021
  • 4
  • 26
  • 35
  • 1
    Why exactly do you want to do this? Please elaborate on your goal. What do you want to do with the library name? – null Mar 13 '15 at 17:31
  • I don't know why you need that, but take a look [here](http://stackoverflow.com/questions/2211001/flash-as3-getting-a-list-of-library-objects) and [here](http://stackoverflow.com/questions/12084097/how-to-list-objects-in-library-using-as3-at-runtime) may be you can find something. – akmozo Mar 13 '15 at 19:04

2 Answers2

1

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))
Harrison
  • 195
  • 1
  • 2
  • 9
0

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.

enter image description here

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
Daniil Subbotin
  • 6,138
  • 5
  • 20
  • 24