A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] image scroller

  1. #1
    formally EquanFX
    Join Date
    May 2001
    Posts
    101

    resolved [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

  2. #2
    Senior Member
    Join Date
    Jan 2009
    Posts
    208
    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.

  3. #3
    formally EquanFX
    Join Date
    May 2001
    Posts
    101
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center