Skip to main content
Inspiring
December 20, 2007
Question

Loading External JPEGs with a fade

  • December 20, 2007
  • 3 replies
  • 362 views
I am working in AS3 to load some external jpeg images and have them fade in after they are loaded. I have this code, which does exactly what I want it to if I am loading a .swf file. But when I try to load a jpeg I get an error. What do I need to change to use a jpeg? Any insight would be greatly appeciated. Thanks.

import fl.transitions.*;
import fl.transitions.easing.*;

var myRequest:URLRequest = new URLRequest("image1.jpg");

var myLoader:Loader = new Loader();

myLoader.load(myRequest);

myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);

function swfLoaded(myEvent:Event):void {
stage.addChild(myLoader);
var myContent:MovieClip = myEvent.target.content;
TransitionManager.start(myContent, {type:Fade, direction:Transition.IN, duration:9, easing:Strong.easeOut});
}
This topic has been closed for replies.

3 replies

kglad
Community Expert
Community Expert
December 20, 2007
you're welcome.
backpagesAuthor
Inspiring
December 20, 2007
Thanks! I'll give that a try.
kglad
Community Expert
Community Expert
December 20, 2007
you're trying to type a bitmapdata object as a movieclip. that's not going to work.

create a bitmap using your bitmapdata object and you can fade that (and add it to the stage).