1. Copy content to system Clipboard
Copy Code code as follows:
System.setclipboard (strcontent);
2. Copy a arraycollection
Copy Code code as follows:
Dummy solution (OK, 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);
3. Open a new browser window
Copy Code code as follows:
Navigatetourl (New URLRequest ("http://www.5ga.cn"), "_blank");
4. Refresh Browser
Copy Code code as follows:
Navigatetourl (New URLRequest ("Javascript:location.reload ();"), "_self");
5. Close the browser
Copy Code code as follows:
Navigatetourl (New URLRequest ("Javascript:window.close ()"), "_self");
6. Set the background of Alert window to transparent
Copy Code code as follows:
Alert {
modaltransparency:0.0;
modaltransparencyblur:0;
}
7. Take random Color
Copy Code code as follows:
Lbl.setstyle (' Color ', 0xffffff*math.random ());
8. Clear the left space of substring
Copy Code code as follows:
Public Function LTrim (s:string): String {
var i:number = 0;
while (s.charcodeat (i) = | | s.charcodeat (i) = = | | s.charcodeat (i) = 9 | | s.charcodeat
i++;
}
Return s.substring (i,s.length);
}
9. Clear String Right space
Copy Code code as follows:
Public Function RTrim (s:string): String {
var i:number = s.length-1;
while (s.charcodeat (i) = | | s.charcodeat (i) = = | | s.charcodeat (i) = = 10 | | S.charcodeat (i) = = 9) {
i--;
}
Return s.substring (0,i+1);
}
10. Clear the space around the string
Copy Code code as follows:
Public Function Trim (s:string): String {
Return LTrim (RTrim (s));
}
11. Get Data type
Copy Code code as follows:
Getqualifiedclassname (data);
12. Generate Random strings.
Copy Code code as follows:
Private Function Generatecheckcode (): String {
Init
var Ran:number;
var Number:number;
var code:string;
var checkcode:string = "";
Get 4 Radom
for (var i:int=0; i<4; i++) {
Ran=math.random ();
Number =math.round (ran*10000); Get result like 0.1234
if (number% 2 = 0)
Code = String.fromCharCode (48+ (number% 10)); 0 ' s ASCII code is 48
Else
Code = String.fromCharCode (65+ (number% 26)); A ' s ASCII code is 65
Checkcode + = code;
}
return checkcode;
}