: Hi,
I am using actionscript 3.
I can load an image in a class but how do I load a number of images eg 4 images that animate.?These 4 images are a walking sequnce of a character.
I am unclear after googling an loading multi images in as3( just love google).
Loading a single image I
- load this into a loader
- Once loaded I load the image into a bitmap and add to a sprite
- I then add the spite to the stage
Q)Now for 4 related images I load 4 loader or 4 sprites or 4 bitmaps or do every thing 4 times?
I want to do collisions eventually and I need bitmaps but bitmaps seem useless to use other than collisions.
Googling for answers isnt helping me clarify this!
this loads 1 image
public function ClassImg3(xx:int,yy:int) {
img1=“scave0.png”
myx=xx;
myy=yy;
var loader:Loader = new Loader;
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
loader.load(new URLRequest(img1));
}
private function imageLoaded(event:Event):void
{
var image:Bitmap = new Bitmap(event.target.content.bitmapData);
sp.addChild(image);
sp.x = myx;
sp.y = myy;
addChild(sp);