Fullscreen in Flash(actionscript)

1.Create one button & give the button instance name “button1”
2.Create new layer name as action,and paste this code.
3.After that in html page,we modify the allfullscreen to true.

import flash.display.StageDisplayState;

function goFullScreen():void
{
if (stage.displayState == StageDisplayState.NORMAL) {
stage.displayState=StageDisplayState.FULL_SCREEN;
} else {
stage.displayState=StageDisplayState.NORMAL;
}
}

stage.addEventListener(MouseEvent.CLICK, _handleClick)

function _handleClick(event:MouseEvent):void
{
goFullScreen();
}

This code is pretty simple. What it does is make the Flash movie go full screen when you click anywhere on the stage. This could easily be tweaked so that it responds to a button click.

Keep in mind that this will only work when you view this in the browser. It’s doesn’t work when compiled inside of Flash CS3.

One thing you want to make sure of is that your embed code has the

tag in the param tags list as well as the allowFullScreen as an attribute in the embed tag. Here is an example:
param name=”allowFullScreen” value=”true” tag in the param tags list as well as the allowFullScreen as an attribute in the embed tag. Here is an example:

<param name=”allowFullScreen” value=”true” />
<param name=”movie” value=”Untitled-3.swf” /><param name=”quality” value=”high” /><param name=”bgcolor” value=”#ffffff” /> <embed src=”Untitled-3.swf” quality=”high” bgcolor=”#ffffff” width=”550″ height=”400″ name=”Untitled-3″ align=”middle” allowScriptAccess=”sameDomain” allowFullScreen=”true” type=”application/x-shockwave-flash” pluginspage=”http://www.macromedia.com/go/getflashplayer” />
</object>

Advertisements

Posted on October 5, 2009, in Flash and tagged . Bookmark the permalink. Leave a comment.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: