# Auto-resize border with attachMovie();

**URL:** <https://forum.kirupa.com/t/auto-resize-border-with-attachmovie/177420>\
**Category:** Uncategorized\
**Created:** [February 1, 2006, 8:18pm UTC](https://forum.kirupa.com/t/auto-resize-border-with-attachmovie/177420 "2006-02-01T20:18:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bandsaw](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@bandsaw](https://forum.kirupa.com/u/bandsaw)\
**Post date:** [February 1, 2006, 8:18pm UTC](https://forum.kirupa.com/t/auto-resize-border-with-attachmovie/177420/1 "2006-02-01T20:18:40Z")

</div>

Ive been up for two nights in a row, trying to figure out how i can use this script with attachMovie(); . Im trying to create a border that auto resizes when MCs (basically just an image imported into an mc) load. This will be expoted as a projetor then burned onto a CD. I just need them to load from the library.

Any help would be greatly appreciated. Heres what i have so far:  
space = 10;  
photo\_mc.\_alpha = 0;  
MovieClip.prototype.loadPhoto = function(photo) {  
this.attachMovie(photo);  
\_level0.photo\_mc.\_alpha = 0;  
\_level0.onEnterFrame = function() {  
var total = photo\_mc.getBytesTotal(), loaded = photo\_mc.getBytesLoaded();  
if (total != 0 && total == loaded) {  
var w = photo\_mc.\_width+space;  
var h = photo\_mc.\_height+space;  
border.resize(w, h);  
delete \_root.onEnterFrame;  
}  
};  
};  
MovieClip.prototype.resize = function(w, h) {  
var speed = 4;  
this.onEnterFrame = function() {  
this.\_width += (w-this.\_width)/speed;  
this.\_height += (h-this.\_height)/speed;  
if (Math.abs(this.\_width-w)\<1) {  
this.\_width = w;  
this.\_height = h;  
\_root.photo\_mc.\_x = this.\_x-this.\_width/2+space/2;  
\_root.photo\_mc.\_y = this.\_y-this.\_height/2+space/2;  
\_root.photo\_mc.\_alpha = 100;  
delete this.onEnterFrame;  
}  
};  
};  
photo\_mc.onEnterFrame = function() {  
photo\_mc.attachMovie(“image1”,1,1);  
};  
stop();  
nextButton.onRelease = function() {  
gotoAndStop(3);  
};  
previousButton.onRelease = function() {  
gotoAndStop(35);  
};
