You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
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