diff --git a/js/scenemanager.js b/js/scenemanager.js index bbf9efb..64f5d33 100644 --- a/js/scenemanager.js +++ b/js/scenemanager.js @@ -69,8 +69,10 @@ function SceneManager(p) hasSetup : "setup" in oScene, hasEnter : "enter" in oScene, hasDraw : "draw" in oScene, + hasExit : "exit" in oScene, setupExecuted : false, - enterExecuted : false }; + enterExecuted : false + }; this.scenes.push(o); return o; @@ -118,6 +120,10 @@ function SceneManager(p) // Re-arm the enter function at each show of the scene o.enterExecuted = false; + if (this.scene && this.scene.hasExit) { + this.scene.oScene.exit(); + } + this.scene = o; // inject sceneArgs as a property of the scene