2013-08-20 2 views
1

Я разрабатываю приложение ipad, в котором я установил соотношение сторон приложения к ландшафту и автоматически задал true в дескрипторе приложения xml, напримерКак остановить ориентацию экрана Ipad при загрузке заставки? - В приложении Flex Mobile

<!-- The initial aspect ratio of the app when launched (either "portrait" or "landscape"). Optional. Mobile only. Default is the natural orientation of the device --> 

<aspectRatio>portrait</aspectRatio> 
<autoOrients>false</autoOrients> 

По умолчанию мое приложение загружается в альбомной ориентации, но когда пользователь держит ipad в представлении «Landscape_Left», т.е. ipad-home-button, обращенном к левой стороне пользователя, тогда экран заставки поворачивается на «Landscape_right», он выглядит вверх ногами. Затем пользователь должен повернуть ipad 180 градусов, чтобы увидеть приложение в прямом представлении, это происходит каждый раз при открытии приложения. Я не могу предотвратить поворот приложения в DEFAULT Landscape, я попытался настроить ориентацию на ROTATED_LEFT в preinitialize, но его вращение на DEFAULT, а затем на LEFT.

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
      xmlns:s="library://ns.adobe.com/flex/spark" applicationDPI="160" 
      addedToStage="application1_addedToStageHandler(event)" 
      preinitialize="application1_preinitializeHandler(event)" 
      creationComplete="application1_creationCompleteHandler(event)" 
      backgroundColor="#333A42" 
      splashScreenImage="@Embed('assets/app_logo.png')" 
      splashScreenMinimumDisplayTime="3000" > 

<fx:Script> 
    <![CDATA[ 
     import mx.events.FlexEvent; 
     import mx.managers.ISystemManager; 


     protected function application1_addedToStageHandler(event:Event):void 
     { 
      // TODO Auto-generated method stub 
      trace("Orientation ::"+this.stage.orientation); 
     } 

     protected function application1_preinitializeHandler(event:FlexEvent):void 
     { 
      // TODO Auto-generated method stub 
      trace("Aspect Ratio ::"+this.aspectRatio); 
      var calAR:String = this.width > this.height ? StageAspectRatio.LANDSCAPE : StageAspectRatio.PORTRAIT; 
      trace("Calculate Aspect Ratio ::"+calAR); 
      var sm:ISystemManager = systemManager; 

      if (sm && sm.stage && sm.isTopLevelRoot()) 
      { 
       //     sm.stage.addEventListener("orientationChanging", stage_orientationChangingHandler); 
       //     sm.stage.addEventListener("orientationChange", stage_orientationChange); 
       trace("System manager Orientation ::"+sm.stage.orientation); 
       trace("System manager Device Orientation ::"+sm.stage.deviceOrientation); 
       sm.stage.setOrientation(StageOrientation.ROTATED_LEFT); 
       sm.stage.setAspectRatio(StageAspectRatio.LANDSCAPE); 
      } 
     } 

     protected function application1_creationCompleteHandler(event:FlexEvent):void 
     { 
      var sm:ISystemManager = systemManager; 

      if (sm && sm.stage && sm.isTopLevelRoot()) 
      { 
       trace("System manager Orientation ::"+sm.stage.orientation); 
       trace("System manager Device Orientation ::"+sm.stage.deviceOrientation); 
      } 
     } 

    ]]> 
</fx:Script> 

<fx:Declarations> 
    <!-- Place non-visual elements (e.g., services, value objects) here --> 
</fx:Declarations> 
<s:BorderContainer height="300" horizontalCenter="0" verticalCenter="0"> 
    <s:VGroup horizontalAlign="center"> 
     <s:TextInput id="txtAspectRatio"/> 
     <s:Button label="Test" click="{txtAspectRatio.text = this.stage.orientation}"/> 
    </s:VGroup> 

</s:BorderContainer> 
</s:Application> 

Есть ли какие-либо исправления для этой проблемы?. Его вращение еще до вызова конструктора приложения.

ответ

Смежные вопросы