-
[RESOLVED] image scroller
Hi. I'm trying to create an image scroller. I would like to load each item in the array into separate bitmaps so i can use smoothing. Here's what i have so far
My problem is it loads the same image 5 times, instead each image once per bitmap. Any help would be appreciated. Thanks in advance.
Code:
var img1:String = "http://www.keithborders.com/images/cars/car1.png";
var img2:String = "http://www.keithborders.com/images/cars/car2.png";
var img3:String = "http://www.keithborders.com/images/cars/car3.png";
var img4:String = "http://www.keithborders.com/images/cars/car4.png";
var img5:String = "http://www.keithborders.com/images/cars/car5.png";
var pix:Array = [img1,img2,img3,img4,img5];
var loader:Loader;
var i:int = 4;
loader = new Loader();
loader.load(new URLRequest(pix[i]));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, mypix);
function mypix(e:Event):void {
for (var i:int = 0; i<pix.length; i++) {
var bmp:Bitmap = new Bitmap(e.target.content.bitmapData);
addChild(bmp);
bmp.width = 215.5;
bmp.height = 144.5;
bmp.x = (bmp.width+10)*i;
bmp.smoothing = true
}
}
A Fool is someone who keeps repeating the same thing, the same way, over, and over and expecting a different result
-
Create new instance of a loader for each image or reuse the same loader but then wait for one current image to load until calling load on next image.
-
Is there a code that you show me, or how to amend the code above? thanks for your reply
A Fool is someone who keeps repeating the same thing, the same way, over, and over and expecting a different result
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|