----- Original Message -----
From: "Alexander Farber" <alexander.far...@gmail.com>
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Sunday, December 28, 2008 10:13 AM
Subject: Re: [Flashcoders] AS3: Dispatching events to further listeners,but
not to itself
Hello,
may I please rephrase my question,
maybe someone will have a hint for me?
By my PlayingCard objects I'd like to
dispatch 2 events: Event.CHANGE
and MouseEvent.CLICK
I do it because in my game you can
drag cards, but also you can select
them from a list and click a button.
So I could use same handler functions.
My problem with the MouseEvent.CLICK
is however that I receive it twice -
1 event comes from the PlayingCard
and another one seems to be dispatched
automatically.
Is there please a way to prevent the
latter event from being sent?
A far better strategy is to stop using generic events and use custom events
to differentiate between the individual situations.
So, you would have a CardSelectedEvent.CARD_SELECTED being used in your game
logic, not generic events. It will make your life much easier.
The click of a chosen card would set the "current" card in your list. The
button click would dispatch the CardSelectedEvent.CARD_SELECTED event.
In general try and avoid using generic handlers for controlling game logic.
Paul
Thank you
Alex
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders