这是来自 Flex 移动项目的一些 Flex 代码。我想将 Rss Feed 加载到具有错误空白的 IList 中。到目前为止,我知道Stringutil.trim(String)。但我卡在我应该使用它来使列表工作的地方。请指教。
<?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:studierende="services.studierende.*"
xmlns:allgemein="services.allgemein.*"
xmlns:veranstaltung="services.veranstaltung.*"
xmlns:wissenschaft="services.wissenschaft.*"
overlayControls="false">
<fx:Script>
<![CDATA[
import flash.net.dns.AAAARecord;
import mx.events.FlexEvent;
import mx.utils.StringUtil;
protected function openmenu(event:MouseEvent):void
{}
protected function reload(event:MouseEvent):void
{
asynclist.removeAll();
getDataResult.token = feed1.getData();
}
protected function loadRSS(event:FlexEvent):void
{
getDataResult.token = feed1.getData();
//I guess here is a good place to trim the whitespaces. But how ?
}
protected function loadfeed(event:MouseEvent,rid:Number):void
{
var rssid:Number = rid;
switch(rssid)
{
case 0:
asynclist.removeAll();
getDataResult.token = feed1.getData();
break;
case 1:
asynclist.removeAll();
getDataResult.token = feed2.getData();
break;
case 2:
asynclist.removeAll();
getDataResult.token = feed3.getData();
break;
case 3:
asynclist.removeAll();
getDataResult.token = feed4.getData();
break;
}
}
]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="getDataResult"/>
<allgemein:Allgemein id="feed1"/>
<studierende:Studierende id="feed2"/>
<veranstaltung:Veranstaltung id="feed3"/>
<wissenschaft:Wissenschaft id="feed4"/>
</fx:Declarations>
<s:navigationContent>
<s:Button id="menubtn" label="Menu" click="openmenu(event)"/>
</s:navigationContent>
<s:actionContent>
<s:Button id="reloadbtn" label="RELOAD" click="reload(event)"/>
</s:actionContent>
<s:List id="list" left="10" right="10" top="50" bottom="10" creationComplete="loadRSS(event)"
itemRenderer="icItemRender" labelField="title">
<s:AsyncListView id="asynclist" list="{getDataResult.lastResult}" />
</s:List>
<s:HGroup x="10" y="10" width="748" height="32">
<s:Button height="32" label="Allgemein" fontSize="12" click="loadfeed(event,0)"/>
<s:Button height="32" label="Studierende" fontSize="12" click="loadfeed(event,1)"/>
<s:Button height="32" label="Veranstaltung" fontSize="12" click="loadfeed(event,2)"/>
<s:Button height="32" label="Wissenschaft" fontSize="12" click="loadfeed(event,3)"/>
</s:HGroup>