# Help needed with Dynamic MovieClips

**URL:** <https://forum.kirupa.com/t/help-needed-with-dynamic-movieclips/51975>\
**Category:** flash\
**Created:** [May 18, 2004, 10:27pm UTC](https://forum.kirupa.com/t/help-needed-with-dynamic-movieclips/51975 "2004-05-18T22:27:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![firstSteps](https://avatars.discourse-cdn.com/v4/letter/f/b487fb/32.png) [@firstSteps](https://forum.kirupa.com/u/firstSteps)\
**Post date:** [May 18, 2004, 10:27pm UTC](https://forum.kirupa.com/t/help-needed-with-dynamic-movieclips/51975/1 "2004-05-18T22:27:16Z")

</div>

Hello All,  
i have a little problem which im hoping some of you can help me with 🙂  
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/](http://www.twinphotographie.com/)

any help would be very much appreciated 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 5, 2004, 6:42pm UTC](https://forum.kirupa.com/t/help-needed-with-dynamic-movieclips/51975/2 "2004-07-05T18:42:07Z")

</div>

: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
