per capire quando il nostro MovieClip è disegnato effettivamente sulla stage: As we have seen repeatedly, in the constructor of a class that extends MovieClip may be necessary to add the event ADDED_TO_STAGE to understand when our MovieClip is actually drawn on the stage:
Articles Tagged 'Stage'
Very short trick: ADDED_TO_STAGE
Movies resizable Flash: Act II
Returning to the Post StageExt Class: resizable Flash movies here is an even easier to get the same effect, only if the library for our movie is at least one Flash component!
Create a symbol, a red square 100 × 100 and place it in the stage calling resizeWindow. Enter the library, not on the Stage, any component, such as a TextInput, and enter the following code in the first frame of the movie.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | managers . SystemManager ; import mx. managers. SystemManager; / / scaleMode = "noscale" Stage . scaleMode = "noScale" / / / / SystemManager.init (); ( "resize" , resizeWindow ) ; SystemManager. AddEventListener ("resize", resizeWindow); / / = function ( Void ) : Void { resizeWindow. resize = function (Void): Void { Object = SystemManager . screen ; var s: Object = SystemManager. screen; _width = s . width ; this. _width = s. width; _height = s . height ; this. _height = s. height; _x = Math . round ( s . x ) ; this. _x = Math . round (s. x); _y = Math . round ( s . y ) ; this. _y = Math . round (s. y); } ( ) ; resizeWindow. resize (); |
Line 6 (SystemManager.init () ;) can be omitted.
StageExt Class: resizable movies in Flash
The technique Fullsize (anteroom for Fullscreen - of which more later) was, until recently, mainly used in Flash applications (RIA), then made a more or less complex user interface, where the container (Adobe AIR , browser or standalone player) scaled by the user, forcing a repositioning of objects composing the movie. The downsizing of the container obviously follows a drawing function, or Refresh MovieClip can reposition or redesign the runtime interface to the new size of the container. Today this technique is also used in more advanced web sites, or varied, extremely comfortable accomodation rendondo interface attractive. The implementation of this technique is quite simple and uses essentially the Stage object's native and introduced with Flash MX version. For its implementation here is a class that allows to obtain the coordinates of the Stage :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | / ** * * @ File StageExt.as * @ Author Giovambattista Fazioli (g.fazioli @ undolog.com) * @ Web http://www.undolog.com * @ @ Email g.fazioli undolog.com * / class {StageExt / / Release __release : String = "1.0" ; private var __ release: String = "1.0"; / / Properties __movieWidth : Number = 0 ; private var __ movieWidth: Number = 0; __movieHeight : Number = 0 ; private var __ movieHeight: Number = 0; __left : Number = 0 ; private var __ left: Number = 0; __right : Number = 0 ; private var __ right: Number = 0; __top : Number = 0 ; private var __ top: Number = 0; __bottom : Number = 23 ; private var __ bottom: Number = 23; / / w : Number , h : Number ) { StageExt function (w: Number , h: Number ) { "StageExt::constructor" ) ; trace (":: StageExt constructor"); / / __movieWidth = w; __movieHeight = h; / / addListener ( this ) ; Stage . addListener (this); } / ** * OnResize () event * / onResize ( ) { onResize private function () { "StageExt::onResize " + Stage . width + ", " + Stage . height ) ; trace (":: StageExt onResize" + Stage . width + "" + Stage . height); / / Number = Math . round ( Stage . width ) ; var sw: Number = Math . round ( Stage . width); Number = Math . round ( Stage . height ) ; var sh: Number = Math . round ( Stage . height); Number = Math . round ( this . __movieWidth ) ; var ow: Number = Math . round (this. __ movieWidth); Number = Math . round ( this . __movieHeight ) ; oh var: Number = Math . round (this. __ movieHeight); / / The x coordinate (top left) __left = - Math . floor ( ( ( sw - ow ) / 2 ) ) ; this. __ left = - Math . floor (((sw - ow) / 2)); __top = - Math . floor ( ( ( sh - oh ) / 2 ) ) ; this. top = __ - Math . floor (((sh - h) / 2)); / / The x coordinate (top right) __right = Math . round ( ( sw + ow ) / 2 ) ; this. __ right = Math . round ((sw + ow) / 2); / / The y coordinate (bottom) __bottom = Math . round ( ( sh + oh ) / 2 ) ; this. __ bottom = Math . round ((sh + O) / 2); } / ** * Refresh () * / Refresh ( ) { public function refresh () { onResize (); } / ** * Left - get * / get Left ( ) : Number { public function get Left (): Number { __left ) ; return (__ left); } / ** * Top - get * / get Top ( ) : Number { public function get Top (): Number { __top ) ; return (__ top); } / ** * Right - get * / get Right ( ) : Number { public function get Right (): Number { __right ) ; return (__ right); } / ** * Bottom - get * / get Bottom ( ) : Number { public function get Bottom (): Number { __bottom ) ; return (__ bottom); } / ** * MovieWidth - get / set * / get MovieWidth ( ) : Number { public function get MovieWidth (): Number { __movieWidth ) ; return (__ movieWidth); } set MovieWidth ( v : Number ) { public function set MovieWidth (v: Number ) { __movieWidth = v; } / ** * MovieHeight - get / set * / get MovieHeight ( ) : Number { public function get MovieHeight (): Number { __movieHeight ) ; return (__ movieHeight); } set MovieHeight ( v : Number ) { public function set MovieHeight (v: Number ) { __movieHeight = v; } } |






Latest Comments
Giovambattista Fazioli : @ Nik: I'm happy! Good luck then!
Nik : I have Monday examining information on java, thanks to me you have been very useful, the book I was unclear ...
Mark : Thank you very much, I've lit
I solved it by setting [cc_objc] / / OptionViewController.m - ...
Giovambattista Fazioli : @ Mark: I suggest you think a more correct approach. If you run the subclass of the tab ...
louis : very clear and simple I have to admit that writing a pa hardly use delegates created by ...