[Flash] Fullscreen Mode


自從flash player 9.0.28 之後,flash 就支援fullscreen~,就已經不用以前的額外javascript。

只要在flash IDE 的publish 加上allowfullscreen,IDE 就會自動加上這個attribute

當然你亦可以在swfobject 自己加上

<param name="allowFullScreen" value="true" />
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
//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);

Source: http://www.bezzmedia.com/swfspot/tutorials/flash8/True_Fullscreen_Flash_Mode

  • Share/Bookmark

, ,

  1. No comments yet.
(will not be published)

Anti-Spam Protection by WP-SpamFree