我对 Actionscript 完全陌生。我到处搜索屏幕方向代码,但找不到合适的。我正在尝试制作一个具有多个页面(框架)的书籍应用程序,该应用程序具有纵向和横向模式。
我找到了 Adam Khoury 编写的代码,但它只适用于一帧。有没有办法将此代码用于具有不同影片剪辑的多个帧(页面)?这是他使用此代码的视频: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);