`
wanjianfei
  • 浏览: 319314 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

12 very simple,basic but useful function source in Flex

阅读更多

No.1 Copy content to clipboard:

  1. System.setClipboard(strContent);

No.2 Clone an ArrayCollection:

  1. //dummy solution( well, it works )
  2. varbar:ArrayCollection = new ArrayCollection();
  3. foreach ( var i:Object in ac ){
  4. bar.addItem(i );
  5. }
  6. // fantastic ! //
  7. varbar:ListCollectionView = new ListCollectionView( ListCollectionView( ac ).list );

No.3 Open URL:

  1. navigateToURL(new URLRequest('http://ntt.cc'), '_blank'

No.4 Page reload:

  1. navigateToURL(new URLRequest("javascript:location.reload();"),"_self")

No.5 Close browse:

  1. navigateToURL(new URLRequest("javascript:window.close()"),"_self");

No.6 Set the background alpha to transparent on Alert window:

  1. Alert
  2. {
  3. modalTransparency:0.0;
  4. modalTransparencyBlur:0;
  5. }

No.7 Set random color:

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

No.8 Trim left of white space

  1. public function LTrim(s : String):String
  2. {
  3. vari : Number = 0;
  4. while(s.charCodeAt(i) == 32 || s.charCodeAt(i) == 13 || s.charCodeAt(i) == 10 || s.charCodeAt(i) == 9)
  5. {
  6. i++;
  7. }
  8. returns.substring(i,s.length);
  9. }

No.9 Trim right of white space

  1. public function RTrim(s : String):String
  2. {
  3. vari : Number = s.length - 1;
  4. while(s.charCodeAt(i) == 32 || s.charCodeAt(i) == 13 || s.charCodeAt(i) == 10 ||s.charCodeAt(i) == 9)
  5. {
  6. i--;
  7. }
  8. returns.substring(0,i+1);
  9. }

No.10 Trim left and right of white space

  1. public function Trim(s : String):String
  2. {
  3. returnLTrim(RTrim(s));
  4. }

No.11 get data type:

  1. getQualifiedClassName(data)

No.12 Generate check digits

  1. private function GenerateCheckCode():String
  2. {
  3. //init
  4. varran:Number;
  5. varnumber:Number;
  6. var code:String;
  7. varcheckCode:String ="";
  8. //get 4 radom
  9. for(vari:int=0; i<4; i++)
  10. {
  11. ran=Math.random();
  12. number =Math.round(ran*10000); //get result like 0.1234
  13. if(number % 2 == 0)
  14. code = String.fromCharCode(48+(number % 10)); //0's ASCII code is 48
  15. else
  16. code = String.fromCharCode(65+(number % 26)) ; // A's ASCII code is 65
  17. checkCode += code;
  18. }
  19. returncheckCode;
  20. }
分享到:
评论

相关推荐

    Learn Python the Hard Way: A Very Simple Introduction

    You Will Learn Python!

    a very simple tableview demo swift

    本项目"A very simple tableview demo swift"旨在展示如何在Swift中创建并操作基本的表格视图。下面将详细阐述相关知识点。 【描述】"一个非常简单的Swift表格视图演示" 这个Swift示例项目旨在帮助初学者理解如何...

    SP_source.zip_Myself And I_Splitter_splitter dialog

    Maybe, it s not useful for you, but if there s only one person who thinks it s useful, I will be very happy. Sometimes you don t need good skill, just a good idea, and by this simple way a useful ...

    very simple image gallery

    "very simple image gallery" 是一个专为 Joomla! 内容管理系统设计的相册管理插件。Joomla 是一款流行的开源 CMS(内容管理系统),它允许用户无需深入编程即可创建和管理网站。这款简单相册插件提供了方便快捷的...

    A SIMPLE MESH GENERATOR IN MATLAB

    We want to offer a short and simple MATLAB code, described in more detail than usual, so the reader can experiment (and add to the code) knowing the underlying principles. We find the node locations ...

    jOOR - Fluent Reflection in Java jOOR is a very simple flu.zip

    标题"jOOR - Fluent Reflection in Java jOOR is a very simple flu.zip"表明这个压缩包可能包含jOOR库的相关代码或文档,帮助用户了解和使用这个库。"Fluent Reflection in Java"强调了jOOR的主要特点,即提供了一...

    Very Simple Ad 1.0.4.3 20160503 unitypackage

    Very Simple Ad 1.0.4.3 20160503 unitypackage

    This example is a very simple solution to sending and receiv

    This example is a very simple solution to sending and receiving data to and from a Parallax Basic Stamp. This example requires a Basic Stamp and the MSComm control. Also included is an example Basic ...

    Very Simple Rating System.rar

    本压缩包"Very Simple Rating System.rar"很可能包含了一个基本的评分系统实现,可能是一个小型项目或示例代码,用于教学或快速原型设计。下面将详细探讨评分系统的概念、组成部分以及可能的设计方法。 1. 评分系统...

    Foundation Flex For Developers - Data-Driven Applications With Php, Asp.Net, Coldfusion

    No book can cover everything, but here you’ll learn some of the more useful tools for Flex application development. Most importantly, you’ll learn how to include external data within your ...

    Sybex - Mastering Visual Basic .NET (VBL).pdf

    who invested in Visual Basic 10 years ago are in demand today. In the world of computing, how- ever, things change very fast, including languages. At some point, they either die, or they evolve into ...

    Very Simple Instant Messenger X-PopUp

    《Very Simple Instant Messenger X-PopUp:简易即时通讯软件解析》 在当今信息化社会,即时通讯工具已经成为我们日常生活中不可或缺的一部分。"Very Simple Instant Messenger X-PopUp"(以下简称X-PopUp)作为一...

    A very simple .m file to read a .fig file and plot it in Octave

    在本主题中,我们讨论的是一个名为"A very simple .m file to read a .fig file and plot it in Octave"的程序,它的目的是在开源软件Octave中打开并显示一个`.fig`文件。 Octave是一个与MATLAB高度兼容的自由软件...

    very useful program

    This is a very useful program

    Very simple application which shows how to get your PC’s IP

    Very simple application which shows how to get your PC’s IP address using the VB Winsock control.

    very-very-basic-hapi-server

    安装步骤: 安装Nodejs- //nodejs.org/en/ 将仓库克隆到所需目录 在终端中,导航到Repo目录。 在终端中键入cd,在d后面加一个空格 将目录拖到终端窗口中,然后按Enter键。 输入npm install并按Enter ...

    Beginning Visual Basic 2010

    Web applications with ASP.NET, and Windows mobile and embedded CE apps with Visual Basic 2010, but you’ll also get a thorough grounding in the basic nuts-and-bolts of writing good code. You’ll be ...

    Android代码-支持展开的 TextView

    Using the library is very simple, look at the source code of the provided sample.  Step 1. In your layout xml: Step 2. In your activity: ((ExpandableTextView) findViewById(R.id.tv)).setText...

    A Simple JPEG Encoder in C#

    But, for a project, my friend 'anirban' required a JPEG encoder in C#. So, we started writing our own encoder. It turned out to be very complex and difficult. The one we wrote from scratch was really...

Global site tag (gtag.js) - Google Analytics