home *** CD-ROM | disk | FTP | other *** search
- class Game.PongModal extends MovieClip
- {
- var bg_mc;
- var keyListener;
- var dispatchEvent;
- var close_btn;
- var base_mc;
- static var backgroundID = "ModalBackground";
- static var LOWEST_DEPTH = -16384;
- var screenName = "modal";
- var __backgroundAlpha = 60;
- static var __inited = false;
- function PongModal()
- {
- super();
- if(!Game.PongModal.__inited)
- {
- this.init();
- }
- this.createBackground();
- this.initCloseButton();
- }
- function set backgroundAlpha(newAlpha)
- {
- this.__backgroundAlpha = newAlpha;
- this.bg_mc._alpha = newAlpha;
- }
- function get backgroundAlpha()
- {
- return this.__backgroundAlpha;
- }
- function close()
- {
- Key.removeListener(this.keyListener);
- this.dispatchEvent({type:"closeModal",name:this.screenName});
- this.removeMovieClip();
- }
- function init()
- {
- mx.events.EventDispatcher.initialize(Game.PongModal.prototype);
- Game.PongModal.__inited = true;
- }
- function initCloseButton(myClose_btn)
- {
- if(!myClose_btn)
- {
- if(!this.close_btn)
- {
- if(!this.base_mc.close_btn)
- {
- return undefined;
- }
- this.close_btn = this.base_mc.close_btn;
- }
- myClose_btn = this.close_btn;
- }
- var controller = this;
- myClose_btn.onRelease = function()
- {
- controller.close();
- };
- }
- function createBackground()
- {
- if(!this.bg_mc)
- {
- this.bg_mc = this.attachMovie(Game.PongModal.backgroundID,"bg_mc",Game.PongModal.LOWEST_DEPTH);
- }
- this.bg_mc._width = Stage.width;
- this.bg_mc._height = Stage.height;
- this.bg_mc._alpha = this.backgroundAlpha;
- this.bg_mc.useHandCursor = false;
- this.bg_mc.onRelease = function()
- {
- };
- }
- }
-