I’m trying to load a jpg and display it, but it won’t display. I have a class called Bike.as, linked to a movieClip in the library. The class essentially tweens a bike graphic across the stage. At the end of the tween, I instantiate a new class called Slideshow. Slideshow loads an image. The image loads(I get no loading error, and I can trace info about the loaded content)… I just can’t seem to see it. In attempting to debug, I wrote the loading code(in Slideshow) into the Bike.as file(replaced the code that instantiates Slideshow), and it worked. Did it work because Bike is linked to a movieclip, and Slideshow is not(Slideshow is called in Bike.as)? I’m attempting to transition from AS2 to AS3. Here’s my Slideshow class:
public class Slideshow extends Sprite {
private var container:Sprite;
private var loader:Loader;
public function Slideshow() {
container = new Sprite();
loader = new Loader();
loader.load(new URLRequest("tester.jpg"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, error);
addChild(loader);
}
function loaded(e:Event):void {
}
function error(event:Event):void {
trace("The URL was not found.");
}
}
…and bike class(linked to MovieClip in Library, and Calls the Slideshow class):
public class Bike extends MovieClip {
private var slideshow:Slideshow;
private var tween:Tween;
private static const startX:int = -170;
private static const endX:uint = 784;
private static const speed:uint = 75;
public function Bike() {
tween = new Tween(this, "x", Strong.easeInOut, startX, endX, speed);
tween.addEventListener(TweenEvent.MOTION_FINISH, initSlideshow);
}
private function initSlideshow(e:TweenEvent):void {
slideshow = new Slideshow();
}
}
Thank you!