views:

135

answers:

1

Hi. I have an actionscript class in my flex app that looks like this:

package Assets
{    
    public class AppIcons {

     public function AppIcons() {

     }

     [Bindable]
     [Embed(source="assets/ico_16.png")]
     public static var Icon_16:Class;

     [Bindable]
     [Embed(source="assets/ico_32.png")]
     public static var Icon_32:Class; 

    }

}

I want to know if I can extend this class and create another class that lets me access the properties as instances of that new class. Since these are static, I cannot access these as instances.

+1  A: 

You don't need an instance to call static variables. You can access them through the class.

Pattern for static method/variable: ClassName.StaticVariableName

So just call:

var icon:Class = AppIcons.Icon_16
zdmytriv
I know that. But I want to access it from another custom class.
Q-rius
From inherited class?
zdmytriv
Lets assume you have instance, not class itself: var appIcons = new AppIcons(); then you can call appIcons.constructor.Icon_16. So use constructor method to call static properties.
zdmytriv