Hi,

 

Try this one:

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
creationComplete="init();" layout="absolute">

            <mx:Script>

                        <![CDATA[

                                   private var pLoader:Loader;

                                   

                                   private function init():void {

                                               pLoader = new Loader();

                                               var
vRequestUrl:URLRequest = new URLRequest();

                                               

                                               vRequestUrl.url =
"http://www.adobe.com/devnet/images/160x160/flex_logo.jpg";;

 
pLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onLoadComplete);

 
pLoader.load(vRequestUrl);

                                   }

                                   

                                   private function
onLoadComplete(anEvent:Event):void {

 
theStage.addChild(pLoader);

                                   }

                        ]]>

            </mx:Script>

            

            <mx:SWFLoader id="theStage" height="100%" width="100%"/>

</mx:Application>

 

Cheers,

Petro

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of nishantkyal
Sent: Tuesday, April 24, 2007 9:32 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Can't load image in flex

 

Hi,

I'm trying to load an image in flex and need help. I'm using the loader
object to load the image and 'addChild'ing it to a CANVAS object placed
on stage. The image apparently loads up (Event.COMPLETE fires) but there
is no image on the CANVAS. :((

I'm pretty conversant with Flash AS2 but this has completely had me.
Please help ... a small example code will be a lot of help to me

 

Reply via email to