我有一个应用程序可以替换 tilelist 中所选符号的行中所选文本,这些符号是动态加载的字符!我不知道该怎么做才能确定选择了多少个字符,如果您选择一个符号,则下载某些字符(替换),如果不是其他字符,则如果字符未被选为或选为 tsyfry ...然后消息...
我只是为了突出显示字符被替换为从tilelist中选择...其余的怎么办!请帮忙 ....
<?xml version="1.0" encoding="utf-8"?>
<mx: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="contactsService.send()"
creationComplete="init()"
layout="absolute" viewSourceURL="srcview/index.html">
<fx:Script>
<![CDATA[
private function replaceSelect(event:MouseEvent):void
{
var obj:Object = lst.selectedItem;
var selStr:int = txt.selectionBeginIndex;
var selEnd:int = txt.selectionEndIndex;
if((lst.selectedItem != null)&&(selStr!=selEnd))
{
txt.text = txt.text.substring(0,selStr)+lst.selectedItem.toString()+txt.text.substring(selEnd,txt.text.length)
}
lst.visible = false;
}
[Bindable]
private var cm:ContextMenu;
private function init():void {
var cmi:ContextMenuItem = new ContextMenuItem("Special Characters", true);
cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, cmSelect);
cm = new ContextMenu();
cm.hideBuiltInItems();
cm.customItems = [cmi];
}
private function cmSelect(evt:ContextMenuEvent):void {
lst.visible = true;
}
]]>
</fx:Script>
<fx:Declarations>
<mx:HTTPService id="contactsService"
resultFormat="e4x"
url="symbols.xml"/>
</fx:Declarations>
<mx:Panel width="508" height="487" x="20" y="20">
<mx:TextInput
id="txt"
text="Test String Flex"
contextMenu="{cm}"
width="303"/>
<mx:TileList
id="lst"
visible="false"
dataProvider="{contactsService.lastResult.symb}"
columnCount="4"
columnWidth="25"
rowCount="3"
rowHeight="25"
verticalScrollPolicy="on"
click="{replaceSelect(event)}"/>
</mx:Panel>
</mx:Application>