Flex 常用语句
打開網(wǎng)址: navigateToURL(new URLRequest('http://www.duzengqiang.com'),'_blank') 頁面重載: navigateToURL(new URLRequest("javascript:location.reload();"),"_self") 關(guān)閉瀏覽器:navigateToURL(new URLRequest("javascript:window.close()"),"_self");
編譯as -keep-generated-actionscript 最上層 parent.setChildIndex(this,parent.numChildren-1); 隨機顏色 :lbl.setStyle('color', 0xffffff*Math.random()); mxmlc -link-report=report.xml Main.mxml mxmlc -load-externs=report.xml ChartModule.mxml DataGrid自適應(yīng)高度:dg.
height=dg.
measureHeightOfItems
(
0,dg.dataprovider.
length
)+dg.
headerHeight
+2;
+2 for 1 pixel border at top and bottom
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 判斷數(shù)據(jù)類型:getQualifiedClassName(數(shù)據(jù)) 復(fù)制ArrayCollection:(From:
http://blog.shiue.net/?p=490) //dummy solution( well, it works ) var bar:ArrayCollection = new ArrayCollection(); for each ( var i:Object in ac ){ bar.addItem( i ); } // fantastic ! // var bar:ListCollectionView = new ListCollectionView( ListCollectionView( ac ).list ); Alert背景透明: Alert{ ? modalTransparency:0.0; ? modalTransparencyBlur:0; }
[size=2]------------------------------------------------------------------------------ 以下轉(zhuǎn)自:http://www.zhuoqun.net/article.asp?id=216 如 何限制TextInput中的輸入。其實文本輸入控件TextInput和TextArea都有一個restrict屬性,它可以控制TextInput 的輸入。這個東西挺有用,可以防止輸入惡意字符串。不過Flex 幫助文檔中對這個屬性介紹的不夠全面,經(jīng)過我實驗N次,總結(jié)出了幾條新的經(jīng)驗: 1. 如果你想要控制用戶只能輸入字母和數(shù)字,就這樣寫:restrict="a-zA-Z0-9"。幫助中只給出了一個例子說"a-z"就是只允許輸入小寫字 母,但是沒有說如何多重限制,自己實驗了一下,終于成功。你按照我上面寫的那樣做就可以多重限制了,中間不用加空格,我實驗過了。 2.幫助文檔中 寫了“^”符號可以限定不允許輸入的字符串,比如"^0"就是不允許輸入0。同樣,幫助中也沒有說明如何限定多個字符。實驗結(jié)果如下:想要控制多個字符的 時候需要加括號,這樣歇restrict="^(';:)",就可以限定多個字符了。另外,你想控制的字符有<>這樣在MXML中有特殊意義 的字符的話,請轉(zhuǎn)換成 <的形式。至于每個符號的編碼是怎么樣的,請打開DreamWeaver,在代碼編輯器中輸入&,然后查看代碼提示,方便又快捷! 三. DataGrid的labelFunction。我需要在DataGrid中現(xiàn)實時間,但是后臺傳回的是格林威治時間,很長,我得需要格式化,這就要用到 labelFunction屬性。這個屬性的值是一個函數(shù),這些都在幫助文檔中有說明,我就不多說了,我想說的是如何用這個東西。先說一下這個函數(shù)需要的 兩個參數(shù):item:類型Object,column:類型DataGridColumn。其中item保存的是顯示在DataGrid中的每一個對象的 引用,而column表示的就是當(dāng)前列,這個column好像沒什么用。我一直以為必須要用到column才可以,結(jié)果總是顯示錯誤。最后終于成功。代碼 如下: ? ? ? ? ? ? 程序代碼 private function formatLabel(item:Object,column:DataGridColumn):String ? ? ? { ? ? ? ? return df.format(item.dates);// df是一個DateFormatter,item中 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //的dates放的是格林威治時間 ? ? ? } -------------------------------------------------------------------------
總結(jié)
- 上一篇: 开源目录2007
- 下一篇: Red5 简单安装指南