Help needed with Dynamic MovieClips

Hello All,
i have a little problem which im hoping some of you can help me with :slight_smile:
i would like to load some images into movie clips, the images are not the same size, so i need the move clip to change size as and when needed here is what i have done so far …

//Define a custom method on movieClip.prototype so that it’s available to all movieClip instances.
MovieClip.prototype.drawSimpleRectangle = function(width,height){
this.lineTo(width,0);
this.lineTo(width,height);
this.lineTo(0,height);
this.lineTo(0,0);
}
//invoke the custom method
_root.createEmptyMovieClip(“rectangle_mc”,1);
rectangle_mc.createEmptyMovieClip(“imageHolder”,1);
rectangle_mc.imageHolder.loadMovie(“test.swf”);
rectangle_mc.beginFill(0xcccccc,12);
rectangle_mc.lineStyle(1,0x999999,10);
rectangle_mc.drawSimpleRectangle(300,100);
rectangle_mc.endFill();
rectangle_mc._x = 250;

//----------------------BUTTONS-------------------
for(i=1;i<4;i++){
_root.createEmptyMovieClip(“button”+i, 100+i);
_root[“button”+i].lineStyle(1, 0x000000, 50);
_root[“button”+i].beginFill(0xcccccc, 100);
_root[“button”+i].moveTo(-25, -10);
_root[“button”+i].lineTo(25, -10);
_root[“button”+i].lineTo(25, 10);
_root[“button”+i].lineTo(-25, 10);
_root[“button”+i].endFill(-25, -10);
_root[“button”+i]._x=i*60;
_root[“button”+i]._y=100;
}
button1.onRelease=function(){
rectangle_mc.imageHolder.loadMovie(“test.swf”);
}
button2.onRelease=function(){
rectangle_mc.imageHolder.loadMovie(“test2.swf”);
}
button3.onRelease=function(){
rectangle_mc.imageHolder.loadMovie("");
}
//------------------ END BUTTONS-------------------------
stop();
a link here is to show what im trying to do
http://www.twinphotographie.com/

any help would be very much appreciated :slight_smile:

:cap: ,… load your image into a emptymovieclip, once the image is loaded into it,… check its properties, like _xscale and _yscale, if the properties don’t match your settings, scale it.

You can check if the image is loaded in to the emptymovie by checking if its _xscale and _yscale are greater than zero. If its greater than zero, scale the emptymovieclip in the size that you want,…:cap:

Good luck,
Martijn Himpers