12 very simple,basic but useful function source in Flex
来源:互联网 发布:javac java文件 编辑:程序博客网 时间:2024/05/08 16:04
No.1 Copy content to clipboard:
- System.setClipboard(strContent);
No.2 Clone an ArrayCollection:
- //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 );
No.3 Open URL:
- navigateToURL(new URLRequest('http://ntt.cc'), '_blank'
No.4 Page reload:
- navigateToURL(new URLRequest("javascript:location.reload();"),"_self")
No.5 Close browse:
- navigateToURL(new URLRequest("javascript:window.close()"),"_self");
No.6 Set the background alpha to transparent on Alert window:
- Alert
- {
- modalTransparency:0.0;
- modalTransparencyBlur:0;
- }
No.7 Set random color:
- lbl.setStyle('color', 0xffffff*Math.random());
No.8 Trim left of white space
- public function LTrim(s : String):String
- {
- var i : Number = 0;
- while(s.charCodeAt(i) == 32 || s.charCodeAt(i) == 13 || s.charCodeAt(i) == 10 || s.charCodeAt(i) == 9)
- {
- i++;
- }
- return s.substring(i,s.length);
- }
No.9 Trim right of white space
- public function RTrim(s : String):String
- {
- var i : Number = s.length - 1;
- while(s.charCodeAt(i) == 32 || s.charCodeAt(i) == 13 || s.charCodeAt(i) == 10 ||s.charCodeAt(i) == 9)
- {
- i--;
- }
- return s.substring(0,i+1);
- }
No.10 Trim left and right of white space
- public function Trim(s : String):String
- {
- return LTrim(RTrim(s));
- }
No.11 get data type:
- getQualifiedClassName(data)
No.12 Generate check digits
- 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;
- }
- 12 very simple,basic but useful function source in Flex
- 12 very simple,basic but useful function source in Flex
- 12 very simple,basic but useful function source in Flex
- 12 very simple,basic but useful function source in Flex
- Very simple multipart/mixed parser in C
- 斜对角线顺序填充矩阵(very useful in DP)
- Very useful learning net
- Very useful VIM command
- android bluez development -----very useful
- Linux shell encyclopedia, very useful
- 1166 Very Simple Problem
- [Java]Very simple problem
- ZOJ Very Simple Counting
- sgu111:Very simple problem
- 111. Very simple problem
- SGU111 Very simple problem
- Delphi - Useful function / procedure
- A useful asp function
- 物理引擎 Havok 可以免费下载了!
- iis不正常工作
- 自定义Go to main table:
- MD5
- 一个BufferedReader 的问题
- 12 very simple,basic but useful function source in Flex
- eval和execScript
- 如何取消“本页不但包含安全的内容,也包含不安全的内容。是否显示不安全的内容。” 的提示
- Winsock编程宝典
- ASP.NET中弹出MessageBox的方法
- PHP $_SERVER[’PHP_SELF’]
- 大规模、高流量Web2.0网站性能调优
- ActionScript Object 到 Java Object 的映射
- expdp,impdp