Class reference vs. class name

var ClassReference:Class = flash.utils.getDefinitionByName("flash.display.Sprite") as Class;

and

var className:String = flash.utils.getQualifiedClassName(thisObj);

It seems that flash.utils.getQualifiedClassName would only take a reference to an instantiated object (as opposed to a class). For example, the following code would return null:

flash.utils.getQualifiedClassName(String);

Which means there is no way of accessing a class name in a static member. For example, you cannot use these utility methods to get class name for your default CSS declaration since this requires we do this in a static method.

private static function classConstruct():Boolean
{
if(!StyleManager.getStyleDeclaration(CLASS_NAME))

……

Here and here.

Advertisements

One Response to “Class reference vs. class name”

  1. Sergey Says:

    Hello

    Please help me brother. I wish to know how to get package name by class name in actionscript 3. For instance `

    var className:String = ‘Sprite’;
    var package:String = getPackage(className);

    Is there such a technic?
    Thanks in advance

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: