0

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
  {

  }

  }
}
Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
Renan
  • 1

1 Answers1

0

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
  • 2,047
  • 1
  • 18
  • 25