Hi there
I am working on a project that creates a list of gigs from an xml file.
The problem I have is that I want to resize the images for the posters once each poster is loaded. The function for the resize works though I can only seem to get it to work from a button after the images have loaded. I have tried to get them to resize after they are loaded using a listener though the images either disappear or don’t resize.
here is my code. Please tell me if there is anything you can see that causes my problem
function ResizeMovie(target_mc:MovieClip){
thisHeight = target_mc._height;
maximumHeight = 80;
thisWidth = target_mc._width;
maximumWidth = 80;
ratio = thisHeight/thisWidth;
if (thisWidth>maximumWidth) {
thisWidth = maximumWidth;
thisHeight = Math.round(thisWidth*ratio);
}
if (thisHeight>maximumHeight) {
thisHeight = maximumHeight;
thisWidth = Math.round(thisHeight/ratio);
}
target_mc._width = thisWidth;
target_mc._height = thisHeight;
//target_mc._x = 10;
//target_mc._y = 10;
};
function addMen(){
for (e=0; e< total; e++) {
///////first I create the gig_mc which contains an empty movie clip called thepic_mc//////////
this.attachMovie("gig_mc", "gig_mc" + e, this.getNextHighestDepth());
/////////next add variables from xml arrays and set position//////////
this["gig_mc"+e]._x = 10;
this["gig_mc"+e]._y = 5+(150*e);
this["gig_mc"+e].gignumber = e;
this["gig_mc"+e].title_txt = thetitle[e];
this["gig_mc"+e].time_txt = time[e];
this["gig_mc"+e].venue_txt = venue[e];
this["gig_mc"+e].date_txt = date[e];
this["gig_mc"+e].rave_txt = rave[e];
this["gig_mc"+e].pic_file = picture[e];
/////////////////here is where I add the poster///////////////////////////
this["gig_mc"+e].thepic_mc.loadMovie(thefile_path);
var my_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadError = function(target_mc:MovieClip, errorCode:String, status:Number) {
trace("Error loading image: " + errorCode + " [" + status + "]");
};
mclListener.onLoadComplete = function(target_mc:MovieClip, status:Number):Void {
// ResizeMovie(target_mc); I tried this though does not work.
};
my_mcl.addListener(mclListener);
my_mcl.loadClip(thefile_path, this["gig_mc"+e].thepic_mc);
picmovies[e]=this["gig_mc"+e].thepic_mc;
}
}
//////////////I can resize the posters with a button////////////////////////
button.onRelease = function(){
for(e=0; e< total; e++){
ResizeMovie(picmovies[e]);
}
}
Please help