So I understand that I can access static properties only child->parent but
not if we instantiate the subclass some where else within the application
but what would be the best way to go around this?
-ButtonParent <-contains basic rollover/rollout/click events and does
dispatchEvent (new Event (BUTTON_CLICK));
-Children inherit ButtonParent and I want to be able to listen for the event
and also get the Name of the child.
var button1 : ButtonParent = new Child();
button1.addEventListener (Child.BUTTON_CLICK, doClickStuff) // of course
wont work because we cant access the static constants from child
button1.addEventListener (ButtonParent.BUTTON_CLICK, doClickStuff)// this
works but now I cant access the NAME from the child
private function doClickStuff ( event : Event ) : void
{
trace(event.target )// Child
trace(event.NAME)// undefined
}
// here is some more about the child
public class Child extends ButtonParent extends IButton
{
public static const NAME : String = "ChildName";
}
Any ideas or recommendations?
I did get around the issue but not using static constants for the
BUTTON_CLICK "constant" and just setting it up as a public var
button1.addEventListener ( button1.BUTTON_CLICK, doClickStuff)// now this
works but looks such an ugly hack.
TIA
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders