# Adding special tweens to auto-resize code

**URL:** <https://forum.kirupa.com/t/adding-special-tweens-to-auto-resize-code/225768>\
**Category:** flash\
**Created:** [May 15, 2007, 3:08pm UTC](https://forum.kirupa.com/t/adding-special-tweens-to-auto-resize-code/225768 "2007-05-15T15:08:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![silverdoves](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/silverdoves/32/1349_2.png) [@silverdoves](https://forum.kirupa.com/u/silverdoves)\
**Post date:** [May 15, 2007, 3:08pm UTC](https://forum.kirupa.com/t/adding-special-tweens-to-auto-resize-code/225768/1 "2007-05-15T15:08:09Z")

</div>

Hey everyone, again!  
I’m still working on a site and I have a question I hope will be pretty quick for those who know actionscript better than I do. I have code where the border resizes to the picture for a slideshow (xml) and I want to change the tween just a bit I have this tween that I want to add to the resize so that it eases out and back in a little. Here is the tween in use for something different, I understand that the only part I would probably use is the “easeInOutBack” part, but just to show you:

```auto
this.resizeTo(420, 420, 2, "easeInOutBack");

```

Here is the code I want to add the tween to:

```auto
#include "mc_tween2.as"
space = 10;
photo_mc._alpha = 0;
MovieClip.prototype.loadPhoto = function(photo){
 photo_mc._alpha = 0;
 this.loadMovie(photo);
 _level0.onEnterFrame = function(){
  // modified the total and loaded so as to round it up
  // to smaller number.
  var total = Math.round(photo_mc.getBytesTotal()/1024);
  var loaded = Math.round(photo_mc.getBytesLoaded()/1024);
  if (total != 0 && loaded>=total){
   var w = photo_mc._width + space;
   var h = photo_mc._height + space;
   border.resize(w, h);
   delete this.onEnterFrame;
  }
 }
};
MovieClip.prototype.resize = function(w, h){
 //the higher the slower the resize of the border
 var speed = 6;
 this.onEnterFrame = function(){
  this._width += (w - this._width)/speed;
  this._height += (h - this._height)/speed;
  if( Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1){
   this._width = w;
   this._height = h;
   photo_mc._x = this._x - this._width/2 + space/2;
   photo_mc._y = this._y - this._height/2 + space/2;
   photo_mc.alphaTo (100, 0.5, "linear")
   delete this.onEnterFrame;
  }
 }
};
image_mc.onLoad = setInterval( nextImage, 7*1000 )
;

```

I was able to add the alpha tween, but since this time the tween would have to work with the dynamic resizing, I don’t know where to put my code, or even what code I need to use, exactly. I would really appreciate any help I can get with this. Thank you all so very much. 🙂

-SD
