熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

程序員常用的Flex代碼總結

2022-06-13   來源: JSP教程 

  刷新浏覽器

   navigateToURL(new URLRequest(javascript:locationreload();)_self)

  關閉浏覽器

   navigateToURL(new URLRequest(javascript:windowclose())_self);

  打開一個新浏覽器窗口

   navigateToURL(new URLRequest() _blank);

  復制一個ArrayCollection

  

  //dummy solution( well it works )

  var bar:ArrayCollection = new ArrayCollection();

  for each ( var i:Object in ac ){

  baraddItem( i );

  }

  // fantastic ! //

  var bar:ListCollectionView = new ListCollectionView( ListCollectionView( ac )list );

  復制內容到系統剪貼板

   SystemsetClipboard(strContent);

  清除子串左側空格

  

  public function LTrim(s : String):String

  {

  var i : Number = ;

  while(scharCodeAt(i) == || scharCodeAt(i) == || scharCodeAt(i) == || scharCodeAt(i) == )

  {

  i++;

  }

  return ssubstring(islength);

  }

  設置Alert 窗口的背景為透明

  

  Alert

  {

  modalTransparency:;

  modalTransparencyBlur:;

  }

  獲取取隨機顏色

   lblsetStyle(color xffffff*Mathrandom());

  獲取數據類型

   getQualifiedClassName(data)

  字符串右側空格清除

  

  public function RTrim(s : String):String

  {

  var i : Number = slength ;

  while(scharCodeAt(i) == || scharCodeAt(i) == || scharCodeAt(i) == ||scharCodeAt(i) == )

  {

  i;

  }

  return ssubstring(i+);

  }

  清除字串左右的空格

  

  public function Trim(s : String):String

  {

  return LTrim(RTrim(s));

  }

  生成隨機字符串

  

  private function GenerateCheckCode():String

  {

  //init

  var ran:Number;

  var number:Number;

  var code:String;

  var checkCode:String =;

  //get radom

  for(var i:int=; i< ; i++)

  {

  ran=Mathrandom();

  number =Mathround(ran*); //get result like

  if(number % == )

  code = StringfromCharCode(+(number % )); //s ASCII code is

  else

  code = StringfromCharCode(+(number % )) ; // As ASCII code is

  checkCode += code;

  }

  return checkCode;

  }


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19331.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.