Multi touch

Enable multi touch support to receive separate events for each finger

In some touch-screen games, you need to detect simultaneous input events. If you enable multi touch support in wade, you can get multiple mouseDown events (one for each finger that touches the screen) even before a single mouseUp event is fired. All you have to do, is call wade.enableMultitouch(). Of course to try this you need a browser that supports multi touch (most mobile browsers do, and Chrome and Internet Explorer support it on touch-screen desktop computers too).
App = function() { this.init = function() { // create a blue square var sprite = new Sprite(); sprite.setSize(100, 100); sprite.setDrawFunction(wade.drawFunctions.solidFill_('blue')); var obj1 = new SceneObject(sprite, 0, -100, 0); // make it red on mouse down, blue on mouse up obj1.onMouseDown = function() { this.getSprite().setDrawFunction(wade.drawFunctions.solidFill_('red')); }; obj1.onMouseUp = function() { this.getSprite().setDrawFunction(wade.drawFunctions.solidFill_('blue')); }; // add to the scene and listen for mouse events wade.addSceneObject(obj1, true); // clone the object to create another square var obj2 = obj1.clone(); obj2.setPosition(100, 0); wade.addSceneObject(obj2, true); // enable multitouch wade.enableMultitouch(); }; };
Your code was executed successfully!