原文(英語): How to make a Flash Lite application running in any screen orientation
対象となるバージョン: Flash Lite 2.x
一部のS60 3rd edition端末は、縦長(portrait)方向と横長(landscape)方向を端末機能として切り替えることができ(N93, N95など)、サードパーティのアプリケーションを使ってできる端末もあります(N73, N80などは、rotateMeを使用することができます)。
デフォルトでは、Flash Liteアプリケーションは、1つの画面サイズのみサポートします(ドキュメントのプロパティタブで定義される)。
アプリケーションを定義したサイズと異なる画面サイズで起動した場合、Flash Playerはドキュメントのサイズを変更し、アプリケーションの両サイドに境界線を追加します。
stop();
fscommand2("FullScreen", true);
/* Set scaleMode to "noScale" setting: the SWF will not be scaled
when the size of the screen device changes*/
Stage.scaleMode = "noScale";
//Set the current alignment of the Flash movie to "Top Left"
Stage.align = "TL";
// Create a new movie Clip
this.createEmptyMovieClip("container",this.getNextHighestDepth());
container._x = 0;
container._y = 0;
//Detect the screen size and load the correct file
if (Stage.width == 240) {
container.loadMovie("file://E:/Others/myApp_portrait.swf");
} else {
container.loadMovie("file://E:/Others/myApp_landscape.swf");
}
2つのSWFファイルにおいて、_rootレベルを参照してはいけません。 全てのリファレンスを、メインSWF(ここではcontainer)に与えられたムービークリップのインスタンス名によって_rootに変更します。
この手法は、前述の手法と似ていますが、外部のSWFファイルをロードする代わりに、内部のムービークリップをロードします。
stop();
fscommand2("FullScreen", true);
/* Set scaleMode to "noScale" setting: the SWF will not be scaled
when the size of the screen device changes*/
Stage.scaleMode = "noScale";
//Set the current alignment of the Flash movie to "Top Left"
Stage.align = "TL";
//Detect the screen size and load the correct movieclip
if (Stage.width == 240) {
_root.attachMovie("portrait_mc","portrait",10);
} else {
_root.attachMovie("landscape_mc","landscape",10);
}
例題のソースコードは、下記サイトからダウンロードできます。
このFlash Lite 2.xアプリケーションは、最新のNokia端末5機種についての情報を取得し、表示します。
また、RSSフィードとFlash LiteのXML操作メソッドを使用しています。
縦長(Portlait)と横長(Landscape)モードをサポートする最新のNokia端末
No related wiki articles found