Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the Flex code commonly used by programmers?

Shulou Source: shulou.com Published: 2022-06-02 06:50:03 10月03日 Update

这篇文章主要为大家展示了"程序员常用Flex代码有哪些",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下"程序员常用Flex代码有哪些"这篇文章吧。

程序员常用的Flex代码总结

1.刷新浏览器的Flex代码

navigateToURL(newURLRequest("_javascript:location. reload();"),"_self")

2.关闭浏览器的Flex代码

navigateToURL(newURLRequest("_javascript:window. close()"),"_self");

3.打开一个新浏览器窗口的Flex代码

navigateToURL(newURLRequest('http://ntt.cc'),'_blank');

4.复制一个ArrayCollection

//dummysolution(well,itworks) varbar:ArrayCollection=newArrayCollection(); foreach(vari:Objectinac){ bar.addItem(i); } //fantastic!// varbar:ListCollectionView=newListCollectionView(ListCollectionView(ac).list);

5.复制内容到系统剪贴板的Flex代码

System.setClipboard(strContent);

6.清除子串左侧空格

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); }

7.设置Alert窗口的背景为透明的Flex代码

Alert { modalTransparency:0.0; modalTransparencyBlur:0; }

8.获取取随机颜色的Flex代码

lbl.setStyle('color',0xffffff*Math.random());

9.获取数据类型的Flex代码

getQualifiedClassName(data)

10.字符串右侧空格清除

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); }

11.清除字串左右的空格的Flex代码

publicfunctionTrim(s:String):String { returnLTrim(RTrim(s)); }

12.生成随机字符串的Flex代码

privatefunctionGenerateCheckCode():String { //init varran:Number; varnumber:Number; varcode:String; varcheckCode:String=""; //get4radom for(vari:int=0;i

Tags: Code common use programs programmers content browsers spaces articles browsing characters strings learning help clipboard right data easy to understand more organization knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Linux MySQL Shulou Tech Info Microsoft