# Smooth Resize onclick \[AS-1\]

**URL:** <https://forum.kirupa.com/t/smooth-resize-onclick-as-1/42512>\
**Category:** flash\
**Created:** [February 10, 2004, 12:31am UTC](https://forum.kirupa.com/t/smooth-resize-onclick-as-1/42512 "2004-02-10T00:31:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [February 10, 2004, 12:31am UTC](https://forum.kirupa.com/t/smooth-resize-onclick-as-1/42512/1 "2004-02-10T00:31:57Z")

</div>

Ok, this is probably pretty simple, but I have a couple of questions.

I have a movieclip that I want to be resized when a button is clicked. I want the animation to be smooth as if it had weight though. I read the tutorial on this but I need something slightly different, I would rather it where I can just refer to a function that is set in another movieclip. That way I could easily refer to it again and just set the height, width, and if possible, x, and y.

And my second question, is how to keep the border of my movieclip that is going to be resized the same thickness. I want the inside to be resized but the sides to stay the same width but move to stay on the edge.

Any help is helpful, of course.

Thanks,  
Jeff:party:

---

<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:** [February 10, 2004, 1:03am UTC](https://forum.kirupa.com/t/smooth-resize-onclick-as-1/42512/2 "2004-02-10T01:03:04Z")

</div>

Would more people respond if I gave code into my post?

---

<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:** [February 10, 2004, 1:14am UTC](https://forum.kirupa.com/t/smooth-resize-onclick-as-1/42512/3 "2004-02-10T01:14:15Z")

</div>

try something like this on the mc u want to resize

[AS]  
onClipEvent(load){  
endXScale = 100  
endYScale = 100  
}  
on(release){  
endXscale=150  
endYscale=150  
}  
onClipEvent(enterFrame){  
\_xscale+=(endXscale-\_xscale)/10  
\_yscale+=(endYscale-\_yscale)/10  
}  
[/AS]

---

<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:** [February 10, 2004, 3:48am UTC](https://forum.kirupa.com/t/smooth-resize-onclick-as-1/42512/4 "2004-02-10T03:48:17Z")

</div>

but is there a way to fix the border from resizing as well, is there also a way to make it look something like below

```auto

onrelease {
      docoolresizeidefinedearlier (0 0 400 400 3) //0 0 being width and height, 400 and 400 both being width and height, and 3 being weight.
}

```

and as I meantioned earlier, what about the borders

So far works beautifully though, thanks

---

<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:** [February 10, 2004, 4:28am UTC](https://forum.kirupa.com/t/smooth-resize-onclick-as-1/42512/5 "2004-02-10T04:28:54Z")

</div>

if u dont want the border to resize the only way is to select hairline in properties of the line

about the function  
it could be like

[AS]  
MovieClip.prototype.doResize = function(startW, startH, endW, endH, weight) {  
this.\_width = startW;  
this.\_height = startH;  
this.onEnterFrame = function() {  
this.\_width += (endW-\_width)/weight;  
this.\_height += (endH-\_height)/weight;  
};  
};  
[/AS]

im too lazy to add something to erase the onEnterframe but maybe itll work anyway

---

<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:** [February 10, 2004, 4:34am UTC](https://forum.kirupa.com/t/smooth-resize-onclick-as-1/42512/6 "2004-02-10T04:34:35Z")

</div>

wow that was fast and did it just perfect,

Thanks so much!  
Jeff

---

<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:** [February 10, 2004, 11:05pm UTC](https://forum.kirupa.com/t/smooth-resize-onclick-as-1/42512/7 "2004-02-10T23:05:34Z")

</div>

wait, now I am confused, I have multiple problems:

1. How do I set it to only resize the object that I am working with, I used _this._ and it didn’t work, it resized everything.

2. I am confused about the function of the numbers I put in. I think there are some stuff that isn’t quite right because I need it to still resize, did you take that out of the second code and change it to moving? I can’t figure out how to do it.

Thanks, Jeff

---

<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:** [February 10, 2004, 11:30pm UTC](https://forum.kirupa.com/t/smooth-resize-onclick-as-1/42512/8 "2004-02-10T23:30:30Z")

</div>

Oh, I think I know what the problem was, I mistyped something earlier, when I said the onrollover stuff, I said  
"//0 0 being width and height, 400 and 400 both being width and height, and 3 being weight."

Really, I meant to say 400 and 400 both being x and y of where it slides to, thus meaining the following:

0 and 0 are the width and height at the end of the sliding, 400 and 400 are where the x and y axis are that they slide to, and 3 being the weight.

Can you do this?

Sorry for the confusion 😃

Thanks,  
Jeff

---

<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:** [February 11, 2004, 11:13pm UTC](https://forum.kirupa.com/t/smooth-resize-onclick-as-1/42512/9 "2004-02-11T23:13:01Z")

</div>

Please somebody at least help me a bit, I don’t know anything about math, I really suck at it, I am only in seventh grade math so I don’t know how to do any of these slide effects myself.:red: :drool:
