I have loaded an image dynamically from PHP into a MC. The movie clip is 80X60 but the jpegs are all different sizes (but in the same proportions). I know that the MC takes the size of the image when it is loaded, but how do I constrain or lock the dimensions of the MC and the jpeg at 80x60? It works if I use _yscale and _xscale but I want the exact dimensions 80X60. Shouldn’t _height and _width work?
Here is the code I’m working with now:
myData = new LoadVars();
myData.load(“data.php”);
myData.onLoad = function(success)
{
if(success)
{
trace(“holler”);
setpic(this.picFile)
}
}
function setpic(pic)
{
trace(“setpic”);
pics.loadMovie(pic);
maxwidth = 80;
maxheight = 60;
if (pics._width > maxwidth) {
delete _root.onEnterFrame;
_root.pics._width = maxwidth;
// Adjust height to new scale
_root.pics._yscale = _root.pics._xscale;
}
// Now check if image is too tall
if (pics._height > maxheight) {
delete _root.onEnterFrame;
_root.pics._height = maxheight;
// Adjust width to new scale
_root.pics._xscale = _root.pics._yscale;
}
}