Here's the situation. I have the following line of code:
console.log(contents.storeShapes_mc.children[i]);
which prints out in the console like so:
lib.Store106II {id: 137, _matrix: a, _rectangle: a, children: Array[2], shape: a…}
I want to retrieve lib.Store106II
to use in my JavaScript, but the console seems to be the one and only place I can get my hands on this particular string of data. Is there any way to access this information from inside the code?
Notes: (1) I am using content created in Flash, exported for EaselJS (2) Due to the syntax Toolkit for CreateJS implements, all of the advice in this answer does not help me, unfortunately.
Edit: Here is the javascript that "Toolkit for CreateJS" exported from Flash to create this object, along with dozens of similar objects:
(lib.Store106II = function() {
this.initialize();
// Layer 1
this.shape = new cjs.Shape();
this.shape.graphics.f().s("#DDE0CE").ss(1,0,0,4).p("AgGE4IEyjjIkfmLIk4Dlg");
this.shape_1 = new cjs.Shape();
this.shape_1.graphics.f("#A0A67C").s().p("AkrhRIE4jmIEfGMIkyDjg");
this.addChild(this.shape_1,this.shape);
}).prototype = p = new cjs.Container();
p.nominalBounds = new cjs.Rectangle(-30,-31.1,60.2,62.4);
/* some other code */
this.s106II = new lib.Store106II();
/* s106II is eventually added as an element of storeShapes_mc
which is in turn added as an element of contents */
With great thanks to fkranenburg on the CreateJS community support forums, I have found the answer to my question! http://community.createjs.com/discussions/easeljs/4568-is-there-a-way-to-retrieve-an-array-of-all-the-custom-classes-created-in-the-lib-namespace
for ( libname in lib ) {
lib[libname].prototype.className = libname;
}
This loop cycles through the lib
namespace (you can do that, apparently!) and retrieves the names of all the constructors created in that namespace. Then, using dynamic referencing (aka square bracket notation, aka array notation) I reference each constructor in that namespace by name and access its prototype to add a new property named className
to objects created by that constructor which returns the name of the object's constructor!