views:

15

answers:

1

Hello,

I'm new to flex, i'm used to flash (CS5 & as3)

I'm trying to load a picture in my swf file to add a DisplacementMapFilter then.

But i'm just cant load that picture.

package 
{
 import flash.display.*;
 import flash.events.*;
 import flash.net.URLRequest;

 public class pano2 extends Sprite
 {
  public var loader_photo:Loader=new Loader();

  public function pano2()
  {
   loader_photo.contentLoaderInfo.addEventListener(Event.COMPLETE,affichage_photo);
   loader_photo.load(new URLRequest('cheval.jpg'));
   addChild(loader_photo);
  }
  public function affichage_photo(ev:Event):void
  {

  }

  }
}
A: 

If you are doing this in Flex is there a reason that you are attempting to do this task in AS3?

You can easily achieve this using Mxml:

<mx:Image source="@Embed(source='../assets/picture.jpg')">
  <mx:filters>
    <mx:DisplacementMapFilter />
  </mx:filters>
</mx:Image>

Now using @Embed does assume that you aren't using an image you want to load at run time, but even so you can change that easily.

cynicaljoy