Question
Adding images from separate class
I'm trying to dynamically add images from a separate class,
called from the main document class. I am using CS3.
My main class is as follows:
package imageReader {
import flash.display.*;
public class LoadTest extends Sprite {
public function LoadTest () {
// constructor
var thumbnail = new XMLImage();
}
}
}
This calls a separate class in the same package named XMLImage. The XMLImage constructor dynamically loads an image, created through the Bitmap/BitmapData/addChild() process (seen in part, below):
largeImage = Bitmap(_loader.content);
largeImageData = largeImage.bitmapData;
addChild(largeImage);
If I call XMLImage directly, as my main document class, it works, and the image appears on the stage. So, there does not appear to be a problem with the process of loading images.
However, if I call it through another class, as above, it still works (via trace), but the image does not appear on the stage.
I'm sure I'm missing something simple here, but... I've been unable to figure it out.
Thanks...
My main class is as follows:
package imageReader {
import flash.display.*;
public class LoadTest extends Sprite {
public function LoadTest () {
// constructor
var thumbnail = new XMLImage();
}
}
}
This calls a separate class in the same package named XMLImage. The XMLImage constructor dynamically loads an image, created through the Bitmap/BitmapData/addChild() process (seen in part, below):
largeImage = Bitmap(_loader.content);
largeImageData = largeImage.bitmapData;
addChild(largeImage);
If I call XMLImage directly, as my main document class, it works, and the image appears on the stage. So, there does not appear to be a problem with the process of loading images.
However, if I call it through another class, as above, it still works (via trace), but the image does not appear on the stage.
I'm sure I'm missing something simple here, but... I've been unable to figure it out.
Thanks...