abseeley
June 17th, 2009, 11:34 PM
I'm trying to make a bare bones as possible image gallery if you will, just the picture and a left and right button. I was able to load an external image using this:
var loader = new Loader();
loader.load(new URLRequest("/img/11.jpg"));
myPictureHolder.addChild(loader);
works just great, and the image shows up just fine, now when the next button is clicked id like it to load the next image and replace the one on screen, i tried just calling load again, didnt work out so well.... whats the best way to go about this keep in mind there could be 1000s of photos so keeping them all in memory is not an option.
:::EDIT:::
well shucks turns out the reason i was getting tossed all awkward images was a simple order of operations problem. but this should help anyone googling this issue
my final code looks like this (after the first image is loaded, to load the next image do this:)
loader.unload();
loader.load(new URLRequest("/yup/" + currentPanel + ".jpg")); //load new picture
myPictureHolder.addChild(loader); //display pictures
var loader = new Loader();
loader.load(new URLRequest("/img/11.jpg"));
myPictureHolder.addChild(loader);
works just great, and the image shows up just fine, now when the next button is clicked id like it to load the next image and replace the one on screen, i tried just calling load again, didnt work out so well.... whats the best way to go about this keep in mind there could be 1000s of photos so keeping them all in memory is not an option.
:::EDIT:::
well shucks turns out the reason i was getting tossed all awkward images was a simple order of operations problem. but this should help anyone googling this issue
my final code looks like this (after the first image is loaded, to load the next image do this:)
loader.unload();
loader.load(new URLRequest("/yup/" + currentPanel + ".jpg")); //load new picture
myPictureHolder.addChild(loader); //display pictures