• Flex 特殊字符及转义符


    mxml中使用特殊字符:

    <    &lt;        

     >   &gt;          
     &   &amp;          
     '    &apos;        
     "  &quot;   



    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>


  • 相关阅读:
    js 模块循环加载
    英文
    浏览器
    ecma
    Speaking JavaScript
    es6 exploringjs 2
    es6 兼容性
    es6 中文
    Exploring ES6
    探索ES6(ES2015)
  • 原文地址:https://www.cnblogs.com/whisht/p/3085065.html
Copyright © 2020-2023  润新知