Hi All,
I’m facing to an annoying problem with flash, I’m trying to resize an image loaded in a movie clip, so that any image I load will always fit correctly in my movie.
The script is pretty simple, it reads an xml file where they should be 6 records. Loads the image in the Thumb attribute in on of the 6 containers eg. _root.screen.Event1
for (i=0; i < 6; i++){
MyEvent = Event*.attributes ;
_root.screen["Event"+i].Title.text = MyEvent.Title ;
_root.screen["Event"+i].Date.text = MyEvent.Date ;
_root.screen["Event"+i].Description.text = MyEvent.Description ;
loadMovie(MyEvent.Path+MyEvent.Thumb,_root.screen["Event"+i].Thumb);
redim(100,100,_root.screen["Event"+i].Thumb);
}
As you can see I try to resize the movie clip directly by using this function :
function redim(maxheight,maxwidth,clip){
if (clip._height > maxheight) {
ratio = clip._height / maxheight;
clip._height = clip._height / ratio;
clip._width = clip._width / ratio;
}
if (clip._width > maxwidth ) {
ratio = clip._width / maxwidth;
clip._height = clip._height / ratio;
clip._width = clip._width / ratio;
}
}
It works but not as expected. It looks like only the container is scaled down not the image really.
How Can I achieve my goal ?
Regards,
Vde