0

我正在使用 Flash CS5.5 开发 iOS 应用程序。我想让 ipad/iphone 停止为orientationChange 设置动画并直接更改它,这可能吗?

我认为这是一个解决方案,但它没有帮助AS3 - 仅 iOS 强制横向模式?.

4

2 回答 2

3

如果您尝试设置Stage.autoOrients = false;flash.events.StageOrientationEvent.ORIENTATION_CHANGE则永远不会触发。这有助于完全禁用方向更改,但对您的问题没有帮助。虽然我自己没有尝试过,但您也许可以收听该事件:

flash.events.StageOrientationEvent.ORIENTATION_CHANGING

您可以调用event.preventDefault()该侦听器来阻止实际旋转的发生。然后你可以自己手动设置:

Stage.setOrientation(StageOrientation.ROTATED_RIGHT);
于 2011-11-13T13:33:58.220 回答
2

您是否尝试过 SO 答案:禁用方向更改旋转动画

该答案中的代码位于作为您的 flash CS5.5 或 air 3.5 之家的视图控制器中:

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
    [UIView setAnimationsEnabled:YES];
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    [UIView setAnimationsEnabled:NO];

    return TRUE;  /* Your original orientation booleans, in case you prevent one of the orientations */
}

该代码使用了UIViewController可以被覆盖的原生 iOS 函数。你必须有一个覆盖的原生 iOS 目标 C 类,UIViewController然后你可以插入上面的代码。作为视图控制器生命周期的一部分,当设备旋转到这些时会进行调用。

于 2012-10-12T03:27:03.150 回答