태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.

ria/flex2008/02/27 12:32

Hey yoww! Ever wanted a background pattern in a complete flash/flex application? Yeah, I know it can be easily done using CSS and setting windowmode = “transparent” while embeding flash object in to html. But upon setting windowmode = “transparent” your flash application doesn’t react to mouse (or) sometimes creates unwanted mess by loosing focus. So, here is one more option. Draw patterned image using “flash.display.Graphics”

  1. import mx.core.BitmapAsset;  
  2.  
  3. [Embed(source="assets/skins/pat.gif")]  
  4. [Bindable]  
  5. public var pat:Class;  
  6.  
  7. private var gd:Graphics;  
  8. private var bg:BitmapAsset =  new pat()as BitmapAsset;  
  9.  
  10. private function init():void{  
  11.     gd = this.graphics;  
  12.     paintBG();  
  13. }  
  14.  
  15. /*  
  16.  You can call this function on resize event  
  17.  So I put it in a separate block  
  18. */  
  19. private function paintBG():void{  
  20.     gd.clear();  
  21.     gd.beginBitmapFill(bg.bitmapData);  
  22.     gd.drawRect(0,0,this.width, this.height);  
  23.     gd.endFill();  
  24. }  

Example pattern:pat.gif

I have used this technique in Flickr Browser, See it in action here


http://blog.insanepixel.com/2008/02/06/background-pattern-flex/

Posted by THLIFE.net

TRACKBACK http://thlife.net/trackback/505 관련글 쓰기

댓글을 달아 주세요