Reorder sprites on the same layer

Even when sprites are on the same layer, you can change their draw order

When sprites are on different layers, layers with lower numbers are always drawn in front of layers with higher numbers. But even for sprites on the same layer you can decide the draw order: just use the pushToBack and bringToFront functions.
App = function() { this.load = function() { wade.loadImage('/snippets/samples/cc_logo.png'); }; this.init = function() { var logo = new SceneObject(new Sprite('/snippets/samples/cc_logo.png')); wade.addSceneObject(logo); this.textSprite = new TextSprite('Mouse down to send to back\nMouse up to bring to front', '20px Verdana', 'blue', 'center'); var textObject = new SceneObject(this.textSprite, 0, 0, 50); wade.addSceneObject(textObject); }; this.onMouseDown = function() { this.textSprite.pushToBack(); }; this.onMouseUp = function() { this.textSprite.bringToFront(); }; };
Your code was executed successfully!