all groups > flash actionscript > july 2005 >
You're in the

flash actionscript

group:

Dynamic Jpg loading with looping


Dynamic Jpg loading with looping JFalk1
7/20/2005 8:54:41 PM
flash actionscript:
I wrote the following code which loads a jpg (photo1.jpg) dynamically and
resizes it ("sizer" function). It works fine, except that I want it to load and
resize a series of jpgs (photo1.jpg - photo6.jpg) into corresponding mcs
(photo1_mc - photo6_mc). I'm assuming I could loop through an array of all the
mc names, and this way only write the functions once, but I can't figure out
the code. Could somebody help? Thanks.

var mc_loader = new MovieClipLoader();
mc_listener = new Object();
mc_listener.onLoadInit = function(photo1_mc) {
if (photo1_mc._width>photo1_mc._height) {
percentage = (150/photo1_mc._width)*100;
sizer(percentage);
}
if (photo1_mc._height>photo1_mc._width) {
percentage = (150/photo1_mc._height)*100;
sizer(percentage);
}
};
mc_loader.addListener(mc_listener);
mc_loader.loadClip("photo1.jpg", photo1_mc);
sizer = function (percentage) {
photo1_mc._xscale = percentage;
photo1_mc._yscale = percentage;
};
Re: Dynamic Jpg loading with looping kglad
7/20/2005 8:58:04 PM
AddThis Social Bookmark Button