You have to wait for the image to load (or embed the jpg).
Listen for the complete event on the Image component instance.

----- Original Message ----- 
From: "danielvlopes" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, November 10, 2007 10:08 PM
Subject: [flexcoders] Re: Background pattern in Flex like in CSS


Hello every body, i trying this but nothing happen, even error:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application creationComplete="initApp()"
xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Image;
import flash.display.*;
import mx.controls.Alert;
import mx.containers.Canvas;

  public function initApp():void{
  var bmd:BitmapData = Bitmap( this.imgBg.content ).bitmapData;
  var container:Canvas = new Canvas();
container.graphics.beginBitmapFill (bmd, null, true, false);
container.graphics.drawRect (0, 0, 500, 500);

addChild (container); 
  }
        
]]>
</mx:Script>

<mx:Image id="imgBg" visible="false" source="../imagens/comum/bg.jpg" />

</mx:Application>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to