Post Pic

Tip to open flash file in full screen in browser

For the Flash Player 9,0,28,0 update, flash applets can go to true full-screen.

There are no fancy javascript hacks needed either. Every User toggles between normal size and fullscreen with a just mouse click, which can toggle Stage["displayState"] from “normal” to “fullScreen”.

The parameter allow FullScreen should be set to true in the applet html, otherwise it will not work

<param name="allowFullScreen" value="true" />

The first thing to do is create a button and add the following code to it:

  1. on(press){
  2. toggleFullScreen();
  3. }

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

01 //Don't scale the movie when the stage size changes 02 Stage.scaleMode="noScale"; 03 //Align the stage to the top left 04 Stage.align = "TL"; 05 //Function to toggle between fullscreen and normal size 06 //the toggle fullscreen button calls this function when pressed 07 function toggleFullScreen(){ 08 //if normal size, go to fullscreen, else go to normal size 09 if(Stage["displayState"]=="normal"){ 10 Stage["displayState"]="fullScreen"; 11 }else{ 12 Stage["displayState"]="normal"; 13 } 14 } 15 //Create a listener for each time the Stage is resized 16 var resizeListener:Object = new Object(); 17 //Called each time the stage is resized 18 resizeListener.onResize = function () { 19 //Move the button to the center of the screen 20 toggleFullScreenButton._x=Stage.width/2; 21 toggleFullScreenButton._y=Stage.height/2; 22 } 22 //Add the listener to Stage 23 Stage.addListener(resizeListener);

Example XHTML used for this applet:


<object data="http://www.exclusivetutorials.com/wp-content/uploads/2010/09/flash-fullscreen.swf"  type="application/x-shockwave-flash" width="400" height="200" >
  <param name="movie" value="http://www.exclusivetutorials.com/wp-content/uploads/2010/09/flash-fullscreen.swf" />
  <param name="allowFullScreen" value="true" />
  </object>

The balls were added in to show that the stage extends to the borders of the screen, even when resized.

View Demo

Related posts:

  1. Top 5 AJAX File Uploaders File Uploading is a basic part of any Blogging, CMS...
  2. Designing a beautiful Contact Form I hope that this will be an interesting tutorial for...
  3. Ajax Validation with Jquery This is a very informative tutorial for developers who want...

Related posts brought to you by Yet Another Related Posts Plugin.

One Response

09.09.10

there is no significant difference between normal size and full view. so i think it must b changed that can creats a significent change

Leave Your Response

* Name, Email, Comment are Required





Lunarpages.com Web Hosting






Legal Documents – Net Lawman


Get Adobe Flash playerPlugin by wpburn.com wordpress themes