这并不容易,但你可以做到。首先,您必须等到阶段初始化并将其缩放属性设置为无缩放(这将停止调整页面大小以填充屏幕)。然后您必须聆听舞台的大小调整(每次旋转 iPhone 时都会触发)并在侦听器处理程序中以适当的方式移动/缩放显示对象。
addEventListener(Event.ADDED_TO_STAGE, init); //Wait for stage initialization
private function init(e:Event):void { //init handler
removeEventListener(Event.ADDED_TO_STAGE, init); //remove listener, which won't be used more
stage.scaleMode = StageScaleMode.NO_SCALE; //set null scaling and top-left align
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, resize); //add handler for resizing
}
private function resize(e:Event):void { //triggers every time iPhone being rotated
//Move/scale your objects here
}