私はActionscriptにまったく慣れていません。画面の向きのコードをどこでも検索しましたが、適切なコードが見つかりませんでした。ポートレートモードとランドスケープモードの両方を備えた数ページ(フレーム)の本アプリを作成しようとしています。
Adam Khouryによって書かれたコードを見つけましたが、1つのフレームでしか機能しません。異なるムービークリップを持つ複数のフレーム(ページ)でこのコードを使用する方法はありますか?これがこのコードを使用している彼のビデオです:goo.gl/T24ku。
// AS3.0 Android App View Modes Script For App View Orientation
// Written by Adam Khoury
import flash.display.Stage;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
// Create stage instance and manipulate 2 of its properties
var appStage:Stage = myApp.stage;
appStage.scaleMode = StageScaleMode.NO_SCALE;
appStage.align = StageAlign.TOP_LEFT;
// Function that executes each time a phone or device is rotated
function orientateMyApp(event:Event):void {
var device_width:int = appStage.stageWidth;
var device_height:int = appStage.stageHeight;
// Condition that allows toggling between view modes
if(device_width > device_height){
myApp.gotoAndStop("wide_view");
} else {
myApp.gotoAndStop("tall_view");
}
}
// Add an event listener for the resize event of the stage instance
appStage.addEventListener(Event.RESIZE, orientateMyApp);