Hi
I am trying (without success) to dispatch a series of custom events fro within an swf loaded using LoaderMax.
I place the event listsners in the class that is loading the swf (call this parent)...
addEventListener(GameEvent.SCORE_UPDATED, gameScoreUpdated)
addEventListener(GameEvent.START, startGame)
addEventListener(GameEvent.START_TURN, startTurn)
addEventListener(GameEvent.COMPLETE_TURN, completeTurn)
addEventListener(GameEvent.INIT, initGame)
And place the dispatchEvent in the SWF that is loaded (call this child):
dispatchEvent(new GameEvent(GameEvent.START));
dispatchEvent(new GameEvent(GameEvent.SCORE_UPDATED));
Etc etc
What is driving me nuts is that the only events that the parent movie is capturing are those that happen when the mouse is clicked.
The custom event bubbles
public class GameEvent extends Event {
/** @private **/
public static const VERSION:Number = 1.0;
public static const INIT:String = "init";
public static const START:String = "start";
public static const COMPLETE:String = "complete";
public static const START_TURN:String = "startTurn";
public static const COMPLETE_TURN:String = "completeTurn";
public static const SCORE_UPDATED:String = "scoreUpdated";
public function GameEvent(type:String, bubbles:Boolean = true, cancelable:Boolean = false) {
super(type, bubbles, cancelable);
}
public override function clone():Event {
return new GameEvent(this.type, this.bubbles, this.cancelable);
}
}
I cant see why my 'global, parent listener) is not capturing the events when the child class inits, starts etc... and yet DOES capture the custom events that are part of a mouse click event in the child (if that makes sense)
Any pointers greatly appreciated !
Thx
Jason