我在製作我的第一個Flex移動應用程序(雖然我不是新來的Flex)方面有一個破解,並且我在第一個障礙時跳閘。flex 4 ViewNavigator的移動問題應用狀態和firstView
我無法獲得ViewNavigatorApplication在嘗試使用firstView時顯示視圖,並顯示狀態。 firstView.phone,firstView.tablet。
我只剩下一個空白的操作欄和內容區域。
如果我嘗試設置設定的firstView無狀態(例如的firstView = 「view.HomeView」)視圖加載罰款。
下面的代碼:
<s:ViewNavigatorApplication
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
firstView.phone="views.HomeView"
firstView.tablet="views.TabletHomeView"
applicationDPI="160"
creationComplete="initApplication()">
<s:states>
<s:State name="portraitPhone" stateGroups="portrait, phone"/>
<s:State name="landscapePhone" stateGroups="landscape, phone"/>
<s:State name="portraitTablet" stateGroups="portrait, tablet"/>
<s:State name="landscapeTablet" stateGroups="landscape, tablet"/>
</s:states>
<fx:Style source="assets/css/application.css"/>
<fx:Script>
<![CDATA[
import mx.events.ResizeEvent;
private var isPortrait:Boolean;
private var isTablet:Boolean;
private function initApplication():void
{
addEventListener(ResizeEvent.RESIZE, resizeHandler);
addEventListener(Event.ADDED_TO_STAGE, resizeHandler);
}
private function resizeHandler(event:*):void
{
isPortrait = (stage.height > stage.width);
isTablet = (stage.height > 950 || stage.width > 950);
currentState = (isPortrait ? "portrait" : "landscape") + (isTablet ? "Tablet" : "Phone");
}
]]>
</fx:Script>
</s:ViewNavigatorApplication>
我GOOGLE了這個死亡,閱讀雖然ViewNavigatorApplication specification並沒有發現任何人有這個問題,或者我只是做錯任何證據(雖然我仍然懷疑是這樣)。
在此先感謝!
我還在學習自己,但如果我理解過程rstand,你不想在ViewNavigatorApplication中創建像這樣的狀態。本質上它只是一個虛擬的容器。在View中創建這樣的狀態。 – JeffryHouser 2011-05-17 12:10:51