/ Published in: ActionScript
URL: http://www.undolog.com/2007/11/12/creare-movieclip-modali-in-topmost/
An Actionscript Class for TopMost MovieClip
Expand |
Embed | Plain Text
/* ** ** file : MovieClipModal.as ** Author : Giovambattista Fazioli ([email protected]) ** Web : http://www.undolog.com ** Email : g (dot) fazioli (at) undolog (dot) (com) ** Created : 08/11/2007 23.57 ** Modified : 08/11/2007 23.57 ** ** */ import mx.managers.DepthManager; // class MovieClipModal extends MovieClip { // private var __release:String = "1.0"; // private var __modal_mc:MovieClip; // private var __movieWidth:Number = 0; private var __movieHeight:Number = 0; private var __left:Number = 0; private var __right:Number = 0; private var __top:Number = 0; private var __bottom:Number = 0; // function MovieClipModal() { Stage.scaleMode = "noscale"; Stage.addListener(this); // onLoad = _onLoad; onUnload = _onUnload; // __movieWidth = Stage.width; __movieHeight = Stage.height; } /* ** _onLoad() - wrap onLoad MovieClip */ private function _onLoad() { //Key.addListener(this); // __modal_mc = _root.createEmptyMovieClip("__modal_mc", DepthManager.kTopmost); __modal_mc.clear(); __modal_mc.beginFill(0xff0000, 100); __modal_mc.moveTo(0, 0); __modal_mc.lineTo(100, 0); __modal_mc.lineTo(100, 100); __modal_mc.lineTo(0, 100); __modal_mc.endFill(); // __modal_mc.setDepthBelow(this); __modal_mc._alpha = 10; //_global.style.modalTransparency; __modal_mc.tabEnabled = __modal_mc.useHandCursor = false; // __modal_mc.onRelease = function() {}; // onResize(); } /* ** _onUnload() - wrap onUnload MovieClip */ private function _onUnload() { __modal_mc.removeMovieClip(); } /* ** onKeyDown - wrap Key */ private function onKeyDown() { if (Key.getCode() == Key.TAB) { //Selection.setFocus(); } } /******************************************************************************************** ** onResize() event ********************************************************************************************/ private function onResize() { var sw:Number = Math.round(Stage.width); var sh:Number = Math.round(Stage.height); var ow:Number = Math.round(this.__movieWidth); var oh:Number = Math.round(this.__movieHeight); // __modal_mc._x = -Math.floor(((sw - ow) / 2)); __modal_mc._y = -Math.floor(((sh - oh) / 2)); __modal_mc._width = Stage.width; __modal_mc._height = Stage.height; } }
You need to login to post a comment.
