close


最近因為以前的作品需要增加全螢幕功能,所以在網路上查了一些資料,
以下六項資料中,第4個和第5個是用actionscript 2.0來寫的,
由於我以前的作品是用actionscript 2.0寫成的,
所以最後是參考了第4個範例來修改,就成功囉!

而第六個資料,是在我完成了之後才找到的資料,
所以我就沒認真研究了,僅列入筆記中。



1.

Adobe Flash ActionScript 3.0 開發人員指南-設定 Stage 的屬性(控制舞台縮放)
http://help.adobe.com/zh_TW/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e31.html


2.

Adobe Flash 的 ActionScript 3.0 程式設計-設定 Stage 的屬性:使用全螢幕模式
http://help.adobe.com/zh_TW/ActionScript/3.0_ProgrammingAS3/WS2E9C7F3B-6A7C-4c5d-8ADD-5B23446FBEEB.html


3.

ActionScript 3.0 的滿版(full browser) Flash 製作
http://blog.mediakid.org/2008/05/actionscript-30-full-browser-flash.html


4.

True Fullscreen Flash Mode(以actionscript 2.0來寫的)
範例可下載參考
http://www.bezzmedia.com/swfspot/tutorials/intermediate/True_Fullscreen_Flash_Mode


5.

full-screen mode in Actionscript 2
http://www.crydust.be/blog/2008/02/19/full-screen-mode-in-actionscript-2/


6.

【技術】嵌入全畫面的Flash並設定最小高與寬
http://blog.roodo.com/esabear/archives/8362809.html





由於我的Flash也沒有很厲害,就不寫教學文了,
這邊僅提供我的作法(作法可能不只一種)。

我的作法是,先設一個「全螢幕按鈕」,按「全螢幕按鈕」可以切換變成全螢幕,再按一次就恢復原來大小。(對這段有興趣的人,請參考上方範例四,這部分我完全依照那個範例的寫法)


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";
}
}

//Add the listener to Stage
Stage.addListener(resizeListener);

接下來,當要變成全螢幕時,就分別指定舞臺上物件的位置,

例如:

背景的寬=舞台的寬
背景的實體名稱._width = Stage.width;

背景的高=舞台的高
背景的實體名稱._height = Stage.height;

某個物件在舞台中的相對位置(這個就類似上方範例四的寫法)

大概就是這樣囉!



其他參考資料(有關Stage):

1.
ActionScript 2.0 語言參考:width (Stage.width 屬性)
http://help.adobe.com/zh_TW/AS2LCR/Flash_10.0/help.html?content=00001545.html

2.
ActionScript 2.0 語言參考:height (Stage.height 屬性)
http://help.adobe.com/zh_TW/AS2LCR/Flash_10.0/help.html?content=00001539.html

3.
stage.width vs. stage.stageWidth in Actionscript 3這二個的差別
http://twturbochen.blogspot.com/2009/03/stagewidth-vs-stagestagewidth-in.html

4.
stage.width vs. stage.stageWidth in Actionscript 3
http://ajarproductions.com/blog/2009/03/18/flash-stage-width-vs-stagewidth-in-actionscript-3/


arrow
arrow

    大俠夫人(Canru) 發表在 痞客邦 留言(0) 人氣()