The class is a rewrite from AS2, so I guess they just left it in there.
In AS3 - for use with getDefinitionByName() or getQualifiedClassName() - those constants serve no purpose, as to get to them you
have to know their package anyway.
----- Original Message -----
From: "Merrill, Jason" <jason.merr...@bankofamerica.com>
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, January 12, 2011 4:38 PM
Subject: RE: [Flashcoders] How to utilize this code: public staticconst:
Needhelp understanding...
but if I'm not mistaken, those were used in the AS2 days to attach a class to a
MovieClip
Not necessarily in this case though. In AS3 you can use things like getDefinitionByName() or getQualifiedClassName() to
dynamically reference or dynamically instantiate an instance of a class. Since this is AS3 code, the use would not be related to
AS2. It could be used like that with dynamic class referencing, or they may just be doing it as available metadata for some odd
reason.
An example of how I have used dynamically generated class instances is if I have some external XML that describes an application
or solution of some kind, and I want to have the XML describewhat objects (and therefore what classes) are created, at runtime in
the Flash player. For example:
var aCoolSpriteClass:Class = getDefinitionByName("aCoolSprite") as Class;
var obj:DisplayObject = new aCoolSpriteClass() as DisplayObject;
Note: Among other things, I changed var to const; I assume "const" was
a better pick... No?
Yes, those would be constants, so I would declare them as const so they cannot be modified. Constants do never change in value at
runtime.
Jason Merrill
Instructional Technology Architect
Bank of America Global Learning
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders