Howdy! I'm Jiby and I'm a web designer creates attractive, accessible standard compliant websites good at css, html

 
 

Toggle a flash swf to window full-screen and normal size

Oct 19 2009

Here is a usefull flash code which helps to toggle between normal size and fullscreen with a simple click, which can toggle Stage displayState from “normal” to “fullScreen”.

The source of the post is from bezzmedia
Open a New flash and create a button and add the following code to it:

on(press){
toggleFullScreen();
}

The code for the function toggleFullScreen and a resize listener are placed on the main stage.

// Don’t scale the movie when the stage size changes
Stage.scaleMode=”noScale”;
//Align the stage to the top left
Stage.align = “TL”;
//Function to toggle between fullscreen and normal size the toggle fullscreen button calls this function when pressed
function toggleFullScreen(){
//if normal size, go to fullscreen, else go to normal size
if(Stage["displayState"]==”normal”){
Stage["displayState"]=”fullScreen”;
}else{
Stage["displayState"]=”normal”;
}
}
//Create a listener for each time the Stage is resized
var resizeListener:Object = new Object();
//Called each time the stage is resized
resizeListener.onResize = function () {
//Move the button to the center of the screen
toggleFullScreenButton._x=Stage.width/2;
toggleFullScreenButton._y=Stage.height/2;
}
//Add the listener to Stage
Stage.addListener(resizeListener);

the object tag is as follows

<object classid=”clsid:d27cdb6e-ae6d-11cf-96b8-444553540000″ width=”400″ height=”200″ codebase=”http://download.macromedia.com/pub/shockwave/
cabs/flash/swflash.cab#version=6,0,40,0″>
<param name=”allowFullScreen” value=”true” />
<param name=”src” value=”http://www.bezzmedia.com/swfspot/resources/34-fullscreen.swf” />
<param name=”allowfullscreen” value=”true” />
<embed type=”application/x-shockwave-flash” width=”400″ height=”200″ src=”http://www.bezzmedia.com/swfspot/resources/34-fullscreen.swf” allowfullscreen=”true”></embed>
</object>

Download the source file below:

Bookmark this..

http://www.jibysk.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/delicious_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/newsvine_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/technorati_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/magnolia_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/google_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/myspace_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/facebook_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/yahoobuzz_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/twitter_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/meneame_48.png

Tags:

Leave a Reply