____  _ ____ ____ ______ ____  
|___ \| |___ \___ \____  |___ \ 
  __) | | __) |__) |  / /  __) |
 |__ <| ||__ <|__ <  / /  |__ < 
 ___) | |___) |__) |/ /   ___) |
|____/|_|____/____//_/   |____/ 
      

i pwn all thats all u need to know.

Thursday, October 11, 2007

Stage.align

//stage align

I used it on this project, zombiedeathsquad.com to keep the alignment centered.

//usage

Stage.align


//value //vertical //horizontal
"T" top center
"B" bottom center
"L" center left
"R" center right
"TL" top left
"TR" top right
"BL" bottom left
"BR" bottom right

I have written a code snippet below to handle the resize of flash/browser window to scale arrordingly to the stage.

set your flash embed tags within your HTML page to '100%' width/height.


//action script code


//center align
Stage.scaleMode = "noScale";
Stage.align = "LT"; //Left-Top see above
Stage.addListener(logo);
logo.onResize = logoCenter;
function logoCenter() {
logo._x = (Stage.width/2)-(logo._width/2);
logo._y = (Stage.width/2)-(logo._width/2);
}
logoCenter();


//details
'_width/2' halves your 'Stage.align' in two this gets your center on the page/flash.


//referance

http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary674.html
http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary680.html

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home