R – Base class for custom components

actionscript-3apache-flexmxml

In my flex app I have various custom components done with mxml or actionscript.
I want all of them to extend a base-class where I can define properties/event listeners etc.
Can someone give me an example how to create that base class and how I can extend it in mxml and actionscript components?

Best Answer

Creating the base class:

ActionScript

In BaseClass.as:

public class BaseClass
{
}

Extending from the base class:

ActionScript

public class SubClass extends BaseClass
{
}

MXML

In a file called SubClass.mxml:

<ns:BaseClass xmlns:ns="path.to.base.*">
</ns:BaseClass>
Related Topic