Create MovieClip modal TopMost
Monday, November 12, 2007 Illustrate a technique to create symbols (MovieClip) procedures to be used similarly to components Alert and Window Flash. The aim is to show a MovieClip above all others, disabling - as well - access to the area below and any other object / component present. To be honest I have achieved all this by doing a little 'reverse engineering by the codes Adobe, which are clear! I do not have withstood ![]()
The Artefizio that is used to disable any interface present below our MovieClip, is to create a transparent MovieClip that takes the whole area of the Stage. In this MovieClip, which will be virtually no visible hooks up a method "void" on the event onRelease being careful to set the property useHandCursor to false
First of all we create a movie with any interface on the main stage:

This consists of a TextField a TextInput and a button used to open our MovieClip modal: our custom pop.
When we added our symbol using attachMovie() what we will see will be:

I left in red alpha=10 the MovieClip ghost that hangs below the interface so as to be seen. Our symbol can be done in any way, just set in the properties an identifier (eg moviemodal) and the class 2.0 to MovieClipModal:

Here is the class MovieClipModal:
- / *
- **
- ** File: MovieClipModal.as
- ** Author: Giovambattista Fazioli (g.fazioli @ undolog.com)
- ** 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
- **
- **
- * /
- managers . DepthManager ; import mx. managers. DepthManager;
- / /
- / /
- / /
- / /
- / /
- MovieClipModal function () (
- / /
- onLoad = _onLoad;
- onunload = _onUnload;
- / /
- width ; __movieWidth = Stage. width;
- height ; __movieHeight = Stage. height;
- )
- / *
- ** _onLoad () - Wrap onLoad MovieClip
- * /
- _onLoad ( ) { _onLoad private function () (
- / / AddListener (this);
- / /
- "__modal_mc" , DepthManager . kTopmost ) ; __modal_mc = _root. createEmptyMovieClip ( "__modal_mc" DepthManager. kTopmost);
- ( ) ; __modal_mc. Clear ();
- ( 0xff0000 , 100 ) ; __modal_mc. beginFill (0xff0000, 100);
- ( 0 , 0 ) ; __modal_mc. moveTo (0, 0);
- ( 100 , 0 ) ; __modal_mc. lineTo (100, 0);
- ( 100 , 100 ) ; __modal_mc. lineTo (100, 100);
- ( 0 , 100 ) ; __modal_mc. lineTo (0, 100);
- ( ) ; __modal_mc. endFill ();
- / /
- this ) ; __modal_mc. setDepthBelow (this);
- ; __modal_mc. _alpha = 10;
- / / _global.style.modalTransparency;
- = __modal_mc . useHandCursor = false ; __modal_mc. tabEnabled = __modal_mc. useHandCursor = false;
- / /
- ( ) { } ; __modal_mc. onRelease = function () ();
- / /
- onResize ();
- )
- / *
- ** _onUnload () - Wrap onUnload MovieClip
- * /
- _onUnload ( ) { _onUnload private function () (
- ; __modal_mc. removeMovieClip ();
- )
- / *
- ** OnKeyDown - Key wrap
- * /
- onKeyDown ( ) { onKeyDown private function () (
- Key . getCode ( ) == Key . TAB ) { if (key. getCode () == Key. TAB) (
- / / Selection.setFocus ();
- )
- )
- /************************************************* *******************************************
- ** OnResize () event
- ************************************************** ******************************************/
- onResize ( ) { onResize private function () (
- / /
- )
- )
This class is only an example and can be expanded and improved. However as it works fine. Of particular interest is the use of DepthManager for placement at depths of our MovieClip modal, thanks to constant kTopmost (lines 43 and 52).
Note also the presence (commentary in this version) to rows 41 and 70 of an additional handler for the keyboard. Our pop-ups, in fact, contains a button that removes a possible unexpected in this system. The addition of ghost MovieClip (lines 43 to 57) and the related event Artefizio onRelease() does not prevent some movements from the keyboard as pressing the TAB key. In some cases, therefore, may need to intercept keyboard activity prior to divert elsewhere, such as restoring fire to an internal control to our MovieClip modal.













undolog  »Blog Archive » Creating MovieClip modal TopMost ...
Illustrate a technique to create symbols (MovieClip) procedures to be used similarly to components and Window Alert Flash. Lâ € ™ goal is to show a MovieClip above all others, disabling - even - € ™ lâ € ™ access to the underlying area ...