Hi,
I use custom events to pass data around - here is a simple example:
package events
{
import flash.events.Event;
public class GameEvent extends Event
{
public var score:int;
public static const GAME_OVER:String = "Game Over";
public function GameEvent(type:String, score:int = 0) :void {
super(type);
this.score = score;
}
override public function clone():Event {
return new GameEvent(this.type, this.score);
}
}
}
dispatchEvent(new GameEvent(GameEvent.GAME_OVER, _score));
scoreEventHandler(event:GameEvent) {
if(event.score > 100) {
//yadda yadda...
}
}
Cor wrote:
Jason: This is all simplified, advanced coders would use some design
patterns or frameworks to handle all this, but you get the idea.
Maybe I am slow... or even dumb?
But all those things I can do with normal events, I guess.
So what I mean was an example of something you cannot do with normal event
or what is specific case for using a custom event?
Kind regards
Cor
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
--
Glen Pike
01326 218440
www.glenpike.co.uk <http://www.glenpike.co.uk>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders