Automatically listen for handled events

When you add an object to the scene, you can tell wade to auto-listen for events

If an object has some event-handling functions when it's added to the scene (for example, if it has an onClick function), you can pass an extra parameter to wade.addSceneObject and set it to true; this will tell WADE that you want your object to listen for any events that it can handle, without having to call wade.addEventListener.
App = function() { this.init = function() { // create a text sprite this.textSprite = new TextSprite('Click right here', '32px Arial', 'red', 'center'); // create a scene object this.textObject = new SceneObject(this.textSprite); // define what happens when the text object is clicked this.textObject.onClick = function() { // we access the sprite as wade.app.textSprite, because this function is not a member of App, so using this.textSprite wouldn't work wade.app.textSprite.setText('Well done!'); }; // add the object to the scene. Note that the second parameter is true // so we don't have to call addEventListener for onClick wade.addSceneObject(this.textObject, true); }; };
Your code was executed successfully!