我是flex编程的新手,所以昨天我做了一点测试,看看它是如何工作的。 一切正常,在模拟器上是正常的,但当我在ipod Touch上运行它是非常慢的。 这是第一个观点:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:itemRenderer="itemRenderer.*"
viewActivate="this.init()" title="Login">
<!-- script -->
<fx:Script>
<![CDATA[
protected function settings_clickHandler(event:MouseEvent):void
{
navigator.pushView(SettingsView);
}
]]>
</fx:Script>
<!-- View -->
<s:actionContent>
<s:Button label="Settings" id="settings" click="settings_clickHandler(event)"/>
</s:actionContent>
</s:View>
这是settingsView:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="Settings" viewActivate="init()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import model.SettingsModel;
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
private var settings:SettingsModel = SettingsModel.getIstance();
[Bindable]
private var servers:ArrayCollection;
protected function save_clickHandler(event:MouseEvent):void
{
if(server.selectedItem.name != 0){
settings.servername = server.selectedItem.name;
}
else{
settings.servername = server2.text;
}
trace("servername: "+settings.servername);
navigator.popView();
}
protected function cancel_clickHandler(event:MouseEvent):void
{
navigator.popView();
}
protected function init():void
{
var ser:Array = new Array;
ser.push({name:"http://localhost/"});
ser.push({name:"http://192.168.0.24/"});
ser.push({name:"http://193.5.152.70/"});
ser.push({name:"0"});
servers = new ArrayCollection(ser);
}
]]>
</fx:Script>
<s:VGroup top="22" width="100%" gap="15" horizontalAlign="center">
<s:Label text="Server: "/>
<s:SpinnerListContainer height="50%" width="80%" >
<s:SpinnerList width="100%" id="server" dataProvider="{servers}" labelField="name">
</s:SpinnerList>
</s:SpinnerListContainer>
<s:TextInput width="80%" id="server2" prompt="insert.." />
<s:HGroup width="100%" horizontalAlign="center" gap="50">
<s:Button id="save" label="Save" click="save_clickHandler(event)"/>
<s:Button id="cancel" label="Cancel" click="cancel_clickHandler(event)"/>
</s:HGroup>
</s:VGroup>
</s:View>
对不起我的英语我希望你能理解我的问题