(function() { "use strict"; var WinScene = function(nextLevel) { this.initialize(nextLevel); } var p = WinScene.prototype = new creatine.Scene(); p.Scene_initialize = p.initialize; p.initialize = function(nextLevel) { this.nextLevel = nextLevel; this.Scene_initialize(); // initialize objects this.background = new createjs.Bitmap(loader.getResult('img_win')); // add objects to scene this.addChild(this.background); this.buttonBack = createButton(140, 40, 'Menu'); this.buttonBack.x = 300; this.buttonBack.y = 480; this.addChild(this.buttonBack); this.buttonNext = createButton(140, 40, 'Next'); this.buttonNext.x = 500; this.buttonNext.y = 480; if (registry.currentLevel < LEVELS.length) this.addChild(this.buttonNext); // register events this.on('sceneenter', this.onSceneEnter); this.on('sceneresume', this.onSceneResume); this.on('scenepause', this.onScenePause); } p.registerEvents = function(event) { this.buttonBack.on('click', this.onButtonBack, this); this.buttonNext.on('click', this.onButtonNext, this); // this.txtAuthor.on('click', this.onGuineaLink, this); // this.buttonGuineaLink.on('click', this.onGuineaLink, this); } p.unregisterEvents = function(event) { this.buttonBack.removeAllEventListeners('click'); this.buttonNext.removeAllEventListeners('click'); // this.buttonGuineaLink.removeAllEventListeners('click'); } p.onClick = function(event) { director.replace( new TutorialScene(), new creatine.transitions.Scroll(creatine.TOP) ) } p.onUpdate = function(event) { } p.onSceneEnter = function(event) { this.registerEvents(); } p.onSceneResume = function(event) { this.registerEvents(); } p.onScenePause = function(event) { this.unregisterEvents(); } p.onGuineaLink = function(event) { window.open('http://guineashots.com','_blank'); } p.onButtonBack = function(event) { director.clearStack(); director.replace( new MenuScene(), new creatine.transitions.FadeInOut(null, 300) ) } p.onButtonNext = function(event) { director.clearStack(); director.replace( new this.nextLevel(), new creatine.transitions.MoveOut( creatine.TOP, null, 800 ) ) } window.WinScene = WinScene; }());