Starling handbook Preview
Starling handbook Preview - Gamua, Starling Framework, Actionscript 3, AS3, Adobe AIR
Starling handbook Preview - Gamua, Starling Framework, Actionscript 3, AS3, Adobe AIR
Erfolgreiche ePaper selbst erstellen
Machen Sie aus Ihren PDF Publikationen ein blätterbares Flipbook mit unserer einzigartigen Google optimierten e-Paper Software.
true.<br />
// classic approach:<br />
var event:Event = new Event("gameOver", true); 1<br />
dispatchEvent(event);<br />
// one-line alternative:<br />
dispatchEventWith("gameOver", true); 2<br />
1 Passing true as second parameter of the Event constructor activates bubbling.<br />
2 Alternatively, dispatchEventWith takes the exact same parameters.<br />
Anywhere along its path, you can listen to this event, e.g. on the dog, its parent, or the stage:<br />
dog.addEventListener("gameOver", onGameOver);<br />
dog.parent.addEventListener("gameOver", onGameOver);<br />
stage.addEventListener("gameOver", onGameOver);<br />
This feature comes in handy in numerous situations, and especially when it comes to user input via<br />
mouse or touch screen.<br />
Moving On<br />
For other topics, make sure to come back for the complete book!<br />
32