您好,登錄后才能下訂單哦!
這篇文章主要介紹常用的Flex源代碼有哪些,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
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.取隨機顏色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.生成隨機字符串.
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)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。