Kathirvel K

Flash (Toggle) Fullscreen browser in Flash

Posted on: December 24, 2009

1) Create New document save it some where in local drive

2) Create button in flash and be sure the button is selected and hit F9
Paste the below code

on (press) {
if (Stage[“displayState”] == “normal”) {
Stage[“displayState”] = “fullScreen”;
Stage[“displayState”] = “normal”

// Code here for resize the movieclip while toggle full screen paste this into frame 1

// Set min size and align of the stage
Stage.scaleMode = “noScale”;Stage.align = “TL”;var _minW:Number = 400;var _minH:Number = 350;
function onResize() { var scaleY:Number = Math.round(100*(Stage.height)/_minH); var scaleX:Number = Math.round(100*(Stage.width)/_minW); var scaleFactor:Number = Math.min(scaleY, scaleX); if (scaleFactor>100) { mc_player._xscale = mc_player._yscale=scaleFactor; _root.mc_player.txtDimentions.text = scaleFactor; } else { mc_player._xscale = mc_player._yscale=100; } mc_player._x = Math.round((Stage.width/2)-(mc_player._width/2)); mc_player._y = Math.round((Stage.height/2)-(mc_player._height/2));

3)Go to FilePublish Settings. Select the HTML tab.

Click the Dimensions drop down box. Select Percent and type 100 for the Width and Height.

Click the Scale drop down box and select No scale.

Then Click the publish

This will create swf and html file

4) In the html page, you must add an extra parameter named allowFullScreen and set it to true. You also might want to set the Flash player version to 9 (this is optional and won’t have any effect if the user already has that version installed).

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
   width="550" height="400" id="sample" align="middle">
   <param name="allowScriptAccess" value="sameDomain" />
   <param name="allowFullScreen" value="true" />
   <param name="movie" value="sample.swf" />
   <param name="quality" value="high" />
   <param name="bgcolor" value="#333333" />
   <embed src="sample.swf" quality="high" bgcolor="#333333"
	   width="550" height="400"
	   name="sample" align="middle"
	   pluginspage="http://www.macromedia.com/go/getflashplayer" />

5) Run the html


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: