Full Screen mode – AS3 Flash Player 9

29 01 2008

[UPDATED] sample site that I used the fullscreen mode: http://my-magic-circle.com.

[UPDATED] sample code added. See below.

Just came across the full-screen issue in AS3. It turned out to be pretty easy to deal with. I am stoked Flash Player 9 has this feature. Developers need to do both of the following 2 things to make this happen.

[Step One] Actionscript

package{

	import flash.display.StageDisplayState;
	import flash.display.Sprite;
	import flash.display.MovieClip;
	import flash.events.MouseEvent;

	public class Main extends Sprite{
		public var _fullScreen_btn:MovieClip;

		protected function handleMouseUp(me:MouseEvent):void
		{
			if (stage.displayState == StageDisplayState.NORMAL) {
				try{
					stage.displayState=StageDisplayState.FULL_SCREEN;
				}
				catch (e:SecurityError){
					//if you don't complete STEP TWO below, you will get this SecurityError
					trace("an error has occured. please modify the html file to allow fullscreen mode")
				}
			}
		}
		public function Main(){
			_fullScreen_btn.addEventListener(MouseEvent.MOUSE_UP,handleMouseUp,false,0,true);
		}
	}
}

[Step Two] html script (the code which embeds the .swf file in the page)

In short, you need to update the value of the param “allowFullScreen” to be “true”.

If the html script was published by Flash IDE, you need to
update two instances of “allowFullScreen” , both from “false” to “true”.

If the html script was published by Flex IDE, you need to add the param
“allowFullScreen” with the value “true” at four places.

My references:

http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode.html
http://www.flashxpress.net/forum/showthread.php?t=64585

Thanks to my friend Will Carpenter‘s help.

Advertisements

Actions

Information

8 responses

24 08 2008
asdasd

stupid, put some code

28 11 2008
paulo

thx!

22 05 2009
nauris

Is there a way to show only one movie clip in full screen instead of all stage?

28 05 2009
Hu

@nauris. You can define a Rectangle as the boundary of the scale. Refer to the 2nd reference link I posted. Code snippet looks like:
var scalingRect:Rectangle = new Rectangle(video.x, video.y, video.width, video.height);
stage[“fullScreenSourceRect”] = scalingRect;

21 06 2009
KIAMOZ

gratE ;).

30 11 2009
Joe

Hi,
I’m a WP newb and need flash to go fullscreen on my blog http://www.lyvido.com. I’m getting “This site prohibits fullscreen activation”. Yours is the closest solution but I’m a bit confused(newb). Where exactly do I get the above codes in WP. Do I need AS(I’m assuming its a tool/language) on my computer to be able to change the WP code? I would be very grateful If you gave me a simpler step by step approach as this will be very important for my visitors. Thanks

8 08 2010
14 01 2011
ZREN

I find Full Screen Button at http://www.as3tutorial.com it’s free, and jsut copy the mc your project, it’s works!

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: