What are the commonly used Flex source code
This article mainly introduces the commonly used Flex source code, the article is very detailed, has a certain reference value, interested friends must read it!
12 commonly used Flex source code
1. Copy the contents to the system clipboard
Java code
System.setClipboard (strContent); System.setClipboard (strContent)
two。 Copy an ArrayCollectionFlex source code
Java code
/ / dummysolution (well,itworks) varbar:ArrayCollection=newArrayCollection (); foreach (vari:Objectinac) {bar.addItem (I);} / varbarbarfrog ListCollectionViewwords newListCollectionView (ListCollectionView (ac) .list); / / dummysolution (well,itworks) varbar:ArrayCollection=newArrayCollection (); foreach (vari:Objectinac) {bar.addItem (I);} / promoasticcards plausible var barbarCollectionViewwords newListCollectionView (ListCollectionView (CollectionView (ac) .list)
3. Open a new browser window
Java code
NavigateToURL (newURLRequest ('http://52friends.com'),'_blank'); navigateToURL (newURLRequest (' http://52friends.com'),'_blank');)
4. Refresh browser Flex source code
Java code
NavigateToURL (newURLRequest ("_ javascript:location.reload ();"), "_ self") navigateToURL (newURLRequest ("_ javascript:location.reload ();"), "_ self")
5. Close the browser Flex source code
Java code
NavigateToURL (newURLRequest ("_ javascript:window.close ()"), "_ self"); navigateToURL (newURLRequest ("_ javascript:window.close ()"), "_ self")
6. Set the background of the Alert window to transparent
Java code
Alert {modalTransparency:0.0;modalTransparencyBlur:0;} Alert {modalTransparency:0.0;modalTransparencyBlur:0;}
7. Take random color Flex source code
Java code
Lbl.setStyle ('color',0xffffff*Math.random ()); lbl.setStyle (' color',0xffffff*Math.random ())
8. Clear the space on the left side of the substring
Java code
PublicfunctionLTrim (s:String): String {vari:Number=0; while (s.charCodeAt (I) = = 32 | | s.charCodeAt (I) = = 13 | s.charCodeAt (I) = = 10 | | s.charCodeAt (I) = = 9) {returns.substring (iMagazine. 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)
9. Clear the space on the right side of the string Flex source code
Java code
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) {returns.substring;} 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) }
10. Clear the space on the left and right of the string
Java code
PublicfunctionTrim (s:String): String {returnLTrim (RTrim (s));} publicfunctionTrim (s:String): String {returnLTrim (RTrim (s));}
11. Get the data type Flex source code
Java code
GetQualifiedClassName (data) getQualifiedClassName (data)
twelve。 Generate a random string.
Java code
PrivatefunctionGenerateCheckCode (): String {/ / init varran:Number; varnumber:Number; varcode:String; varcheckCode:String= ""; / / get4radom for (vari:int=0;i