mxml中使用特殊字符:
< <
> >
& &
' '
" "
as文件中使用特殊字符
原文地址:http://blog.minidx.com/2008/07/06/1048.html
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white" creationComplete="init()" viewSourceURL="srcview/index.html"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; [Bindable] private var charCodes:ArrayCollection; private function init():void { charCodes = new ArrayCollection(); var i:int; for (i = slider.values[0]; i <= slider.values[1]; i++) { charCodes.addItem({charCodeNum:i, charCodeValue:"&#" + formatString(i) + ";", charCodeStr:String.fromCharCode(i)}); } } private function formatString(str:Object, minLength:int = 4):String { return ("000000000" + str.toString()).substr(-minLength); } ]]> </mx:Script> <mx:VBox> <mx:DataGrid id="dataGrid" dataProvider="{charCodes}" width="300"> <mx:columns> <mx:DataGridColumn dataField="charCodeStr" /> <mx:DataGridColumn dataField="charCodeValue" /> </mx:columns> </mx:DataGrid> <mx:HBox width="100%"> <mx:HSlider id="slider" minimum="32" maximum="512" thumbCount="2" values="[0, 512]" liveDragging="true" snapInterval="1" tickInterval="32" dataTipPrecision="0" change="init()" /> <mx:Label text="`{dataGrid.selectedItem.charCodeStr}` = {dataGrid.selectedItem.charCodeValue}" selectable="true" /> </mx:HBox> </mx:VBox> <mx:Label text="© {new Date().fullYear} Flex Examples" /> </mx:Application>