Archived:任意の画面方向で動作するFlash Liteアプリケーションの作成方法
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.
We do not recommend Flash Lite development on current Nokia devices, and all Flash Lite articles on this wiki have been archived. Flash Lite has been removed from all Nokia Asha and recent Series 40 devices and has limited support on Symbian. Specific information for Nokia Belle is available in Flash Lite on Nokia Browser for Symbian. Specific information for OLD Series 40 and Symbian devices is available in the Flash Lite Developers Library.
We do not recommend Flash Lite development on current Nokia devices, and all Flash Lite articles on this wiki have been archived. Flash Lite has been removed from all Nokia Asha and recent Series 40 devices and has limited support on Symbian. Specific information for Nokia Belle is available in Flash Lite on Nokia Browser for Symbian. Specific information for OLD Series 40 and Symbian devices is available in the Flash Lite Developers Library.
Article Metadata
Compatibility
Platform(s): Flash Lite 2.x
Article
Translated:
By morisawafnj
Last edited: hamishwillee
(14 May 2013)
一部のS60 3rd edition端末は、縦長(portrait)方向と横長(landscape)方向を端末機能として切り替えることができ(N93, N95など)、サードパーティのアプリケーションを使ってできる端末もあります(N73, N80などは、rotateMe を使用することができます)。
デフォルトでは、Flash Liteアプリケーションは、1つの画面サイズのみサポートします(ドキュメントのプロパティタブで定義される)。
アプリケーションを定義したサイズと異なる画面サイズで起動した場合、Flash Playerはドキュメントのサイズを変更し、アプリケーションの両サイドに境界線を追加します。
外部のSWFファイルを使用する
- 2つのSWFファイルを作成します。1つは縦長(portlait)方向のアプリケーション、もう1つは横長(landscape)方向のアプリケーションとします。この例では、それらをそれぞれmyApp_portrait.swf(240x320)、myApp_landscape.swf(320x240)と呼びます。
- 新たにFlash Liteアプリケーションを作成します(myApp.swf)。
- ドキュメントのプロパティタブを使用し、ドキュメントの幅と高さを指定できる最大値(ここでは320x320)に変更します。
- myApp.flaファイルの最初のキーフレームに、下記コードを追加します。
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");
}
- myApp.swfを起動すると、アプリケーションを現在の画面方向に合わせて表示します。
2つのSWFファイルにおいて、_rootレベルを参照してはいけません。 全てのリファレンスを、メインSWF(ここではcontainer)に与えられたムービークリップのインスタンス名によって_rootに変更します。
単一のSWFファイルを使用する
この手法は、前述の手法と似ていますが、外部のSWFファイルをロードする代わりに、内部のムービークリップをロードします。
- 新たにFlash Liteアプリケーションを作成します(myApp.swf)。
- ドキュメントの幅と高さを、ドキュメントのプロパティタブを使用し、ドキュメントの幅と高さを指定できる最大値(ここでは320x320)に変更します。
- 最初のキーフレームに、下記コードを追加します。
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);
}
- ムービークリップを作成します。
- メニューより、挿入 -> 新規シンボル... -> ムービークリップを選択し名前を指定
- ActionScriptに書き出しにチェックし、識別子を portrait_mcに設定します。
- この一連の操作全てを、"landscape_mc"ムービークリップと320x240サイズ矩形で繰り返します。
- myApp.swfを起動します。アプリケーションを現在の画面方向に合わせて表示します。
ダウンロード
例題のソースコードは、下記サイトからダウンロードできます。
このFlash Lite 2.xアプリケーションは、最新のNokia端末5機種についての情報を取得し、表示します。
また、RSSフィードとFlash LiteのXML操作メソッドを使用しています。








(no comments yet)