這篇文章主要介紹常用的Flex源代碼有哪些,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!
項城ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:13518219792(備注:SSL證書合作)期待與您的合作!
12條常用的Flex源代碼
1.復(fù)制內(nèi)容到系統(tǒng)剪貼板
Java代碼
System.setClipboard(strContent); System.setClipboard(strContent);
2.復(fù)制一個ArrayCollectionFlex源代碼
Java代碼
//dummysolution(well,itworks) varbar:ArrayCollection=newArrayCollection(); foreach(vari:Objectinac){ bar.addItem(i); } //fantastic!// varbar:ListCollectionView=newListCollectionView(ListCollectionView(ac).list); //dummysolution(well,itworks)varbar:ArrayCollection=newArrayCollection(); foreach(vari:Objectinac){bar.addItem(i);} //fantastic!//varbar:ListCollectionView=newListCollectionView(ListCollectionView(ac).list);
3.打開一個新瀏覽器窗口
Java代碼
navigateToURL(newURLRequest('http://52friends.com'),'_blank'); navigateToURL(newURLRequest('http://52friends.com'),'_blank');
4.刷新瀏覽器Flex源代碼
Java代碼
navigateToURL(newURLRequest("javascript:location.reload();"),"_self") navigateToURL(newURLRequest("javascript:location.reload();"),"_self")
5.關(guān)閉瀏覽器Flex源代碼
Java代碼
navigateToURL(newURLRequest("javascript:window.close()"),"_self"); navigateToURL(newURLRequest("javascript:window.close()"),"_self");
6.設(shè)置Alert窗口的背景為透明
Java代碼
Alert { modalTransparency:0.0; modalTransparencyBlur:0; } Alert{modalTransparency:0.0;modalTransparencyBlur:0;}
7.取隨機(jī)顏色Flex源代碼
Java代碼
lbl.setStyle('color',0xffffff*Math.random()); lbl.setStyle('color',0xffffff*Math.random());
8.清除子串左側(cè)空格
Java代碼
publicfunctionLTrim(s:String):String { vari:Number=0; while(s.charCodeAt(i)==32||s.charCodeAt(i)==13||s.charCodeAt(i)==10||s.charCodeAt(i)==9) { i++; } returns.substring(i,s.length); } publicfunctionLTrim(s:String):String{vari:Number=0; while(s.charCodeAt(i)==32||s.charCodeAt(i)==13||s.charCodeAt(i)==10|| s.charCodeAt(i)==9){i++;}returns.substring(i,s.length);}
9.清除字串右側(cè)空格Flex源代碼
Java代碼
publicfunctionRTrim(s:String):String { vari:Number=s.length-1; while(s.charCodeAt(i)==32||s.charCodeAt(i)==13||s.charCodeAt(i)==10||s.charCodeAt(i)==9) { i--; } returns.substring(0,i+1); } publicfunctionRTrim(s:String):String{vari:Number=s.length-1; while(s.charCodeAt(i)==32||s.charCodeAt(i)==13||s.charCodeAt(i)==10 ||s.charCodeAt(i)==9){i--;}returns.substring(0,i+1);}
10.清除字串左右的空格
Java代碼
publicfunctionTrim(s:String):String { returnLTrim(RTrim(s)); } publicfunctionTrim(s:String):String{returnLTrim(RTrim(s));}
11.獲取數(shù)據(jù)類型Flex源代碼
Java代碼
getQualifiedClassName(data) getQualifiedClassName(data)
12.生成隨機(jī)字符串.
Java代碼
privatefunctionGenerateCheckCode():String { //init varran:Number; varnumber:Number; varcode:String; varcheckCode:String=""; //get4radom for(vari:int=0;i<4;i++) { ran=Math.random(); number=Math.round(ran*10000);//getresultlike0.1234 if(number%2==0) code=String.fromCharCode(48+(number%10));//0'sASCIIcodeis48 else code=String.fromCharCode(65+(number%26));//A'sASCIIcodeis65 checkCode+=code; } returncheckCode; } privatefunctionGenerateCheckCode():String{//initvarran:Number; varnumber:Number;varcode:String;varcheckCode:String=""; //get4radomfor(vari:int=0;i<4;i++){ran=Math.random();number=Math.round(ran*10000); //getresultlike0.1234if(number%2==0)code=String.fromCharCode(48+(number%10)); //0'sASCIIcodeis48elsecode=String.fromCharCode(65+(number%26)); //A'sASCIIcodeis65checkCode+=code;}returncheckCode;}
以上是“常用的Flex源代碼有哪些”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!