Re: [Flashcoders] Inheritance and Static properties

2009-10-22 Thread Helmut Granda
Correct, i was thinking of
var object = event.target
object.NAME;

but I was typing faster than thinking :).



On Thu, Oct 22, 2009 at 1:00 PM, jonathan howe wrote:

> Just double checking but in your trace statement you are looking for
> the NAME property on the event?
>
> trace(event.NAME)// undefined
> You probably mean event.target.NAME but I'm just checking the obvious.
>
> -jonathan
>
>
> On Thu, Oct 22, 2009 at 12:38 PM, Helmut Granda  >wrote:
>
> > 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
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
>
>
>
> --
> -jonathan howe
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Inheritance and Static properties

2009-10-22 Thread jonathan howe
Just double checking but in your trace statement you are looking for
the NAME property on the event?

trace(event.NAME)// undefined
You probably mean event.target.NAME but I'm just checking the obvious.

-jonathan


On Thu, Oct 22, 2009 at 12:38 PM, Helmut Granda wrote:

> 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
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
-jonathan howe
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Inheritance and Static properties

2009-10-22 Thread Helmut Granda
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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders