【发布时间】:2011-09-02 19:13:00
【问题描述】:
我想加载一个初始组件以在我的 flex 应用程序中显示,这取决于是否设置了 SharedObject 中的值(首次启动)。我该如何做到这一点?
【问题讨论】:
标签: apache-flex actionscript-3 flex4.5 mate mate-flex-framework
我想加载一个初始组件以在我的 flex 应用程序中显示,这取决于是否设置了 SharedObject 中的值(首次启动)。我该如何做到这一点?
【问题讨论】:
标签: apache-flex actionscript-3 flex4.5 mate mate-flex-framework
很简单:
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
applicationComplete="onApplicationComplete()">
<fx:Script>
<![CDATA[
private function onApplicationComplete():void
{
var so:SharedObject = SharedObject.getLocal('something');
// add conditionals here
addElement(new SomeView());
}
]]>
</fx:Script>
</s:Application>
或与状态:
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
applicationComplete="onApplicationComplete()">
<fx:Script>
<![CDATA[
private function onApplicationComplete():void
{
var so:SharedObject = SharedObject.getLocal('something');
// add conditionals here
this.currentState = 'someview2';
}
]]>
</fx:Script>
<s:states>
</s:State name="someview" />
</s:State name="someview2" />
</s:State name="someview3" />
</s:states>
<local:SomeView includeIn="someview" width="100%" height="100%" />
<local:SomeView2 includeIn="someview2" width="100%" height="100%" />
<local:SomeView3 includeIn="someview3" width="100%" height="100%" />
</s:Application>
【讨论】: