Fixes #382 Error when using InputHandler#onInputUp & sprite destroys itself during the event.

This commit is contained in:
photonstorm
2014-02-10 02:14:59 +00:00
parent 0294a4735d
commit ae74cb02dd
5 changed files with 62 additions and 16 deletions
+12 -4
View File
@@ -14,14 +14,16 @@ var p;
function create() {
game.stage.backgroundColor = '#ff5500';
// game.stage.backgroundColor = '#ff5500';
game.renderer.useFillRect = false;
// game.renderer.useFillRect = false;
sprite = game.add.sprite(0.5, 0, 'pic');
sprite2 = game.add.sprite(0, 300, 'pic');
// sprite2 = game.add.sprite(0, 300, 'pic');
game.input.onDown.add(tint, this);
sprite.inputEnabled = true;
sprite.events.onInputDown.add(tint, this);
sprite.events.onInputUp.add(wibble, this);
// game.add.tween(sprite).to({y: 500}, 3000, Phaser.Easing.Linear.None, true);
@@ -37,6 +39,12 @@ function tint() {
}
function wibble() {
console.log(sprite);
}
function update() {