# Scaling, alpha, position issues

**URL:** <https://forum.kirupa.com/t/scaling-alpha-position-issues/62686>\
**Category:** Uncategorized\
**Created:** [August 30, 2004, 4:17pm UTC](https://forum.kirupa.com/t/scaling-alpha-position-issues/62686 "2004-08-30T16:17:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![headznet](https://avatars.discourse-cdn.com/v4/letter/h/34f0e0/32.png) [@headznet](https://forum.kirupa.com/u/headznet)\
**Post date:** [August 30, 2004, 4:17pm UTC](https://forum.kirupa.com/t/scaling-alpha-position-issues/62686/1 "2004-08-30T16:17:04Z")

</div>

I tried using this code because I need some mc to scale, others to fade, and others to move; but it won’t work. It only allows the last function to work (in this case alpha).

MovieClip.prototype.easeScale = function(scaSpeed, mcH, mcW) {  
this.onEnterFrame = function() {  
this.\_height += (mcH-this.\_height)/scaSpeed;  
this.\_width += (mcW-this.\_width)/scaSpeed;  
};  
};  
MovieClip.prototype.easePosition = function(posSpeed, mcX, mcY) {  
this.onEnterFrame = function() {  
this.\_x += (mcX-this.\_x)/posSpeed;  
this.\_y += (mcY-this.\_y)/posSpeed;  
};  
};  
MovieClip.prototype.easeAlpha = function(alpSpeed, mcA) {  
this.onEnterFrame = function() {  
this.\_alpha += (mcA-this.\_alpha)/alpSpeed;  
};  
};  
box\_mc.onRelease = function() {  
box\_mc.easeScale(8, 100, 10);  
box\_mc.easePosition(8, 400, 300);  
box\_mc.easeAlpha(8, 60);  
};

---

<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:** [August 30, 2004, 4:32pm UTC](https://forum.kirupa.com/t/scaling-alpha-position-issues/62686/2 "2004-08-30T16:32:57Z")

</div>

> [@headznet](#):
>
> I tried using this code because I need some mc to scale, others to fade, and others to move; but it won’t work. It only allows the last function to work (in this case alpha).
> 
> MovieClip.prototype.easeScale = function(scaSpeed, mcH, mcW) {  
> this.onEnterFrame = function() {  
> this.\_height += (mcH-this.\_height)/scaSpeed;  
> this.\_width += (mcW-this.\_width)/scaSpeed;  
> };  
> };  
> MovieClip.prototype.easePosition = function(posSpeed, mcX, mcY) {  
> this.onEnterFrame = function() {  
> this.\_x += (mcX-this.\_x)/posSpeed;  
> this.\_y += (mcY-this.\_y)/posSpeed;  
> };  
> };  
> MovieClip.prototype.easeAlpha = function(alpSpeed, mcA) {  
> this.onEnterFrame = function() {  
> this.\_alpha += (mcA-this.\_alpha)/alpSpeed;  
> };  
> };  
> box\_mc.onRelease = function() {  
> box\_mc.easeScale(8, 100, 10);  
> box\_mc.easePosition(8, 400, 300);  
> box\_mc.easeAlpha(8, 60);  
> };

put them all into one function, with one onEnterFrame.

---

<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:** [August 30, 2004, 4:39pm UTC](https://forum.kirupa.com/t/scaling-alpha-position-issues/62686/3 "2004-08-30T16:39:28Z")

</div>

I need to use them s[font=‘Times New Roman’]eparately[/font] so I need them to work by themselves.

---

<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:** [August 30, 2004, 4:52pm UTC](https://forum.kirupa.com/t/scaling-alpha-position-issues/62686/4 "2004-08-30T16:52:42Z")

</div>

> [@headznet](#):
>
> I need to use them s[font=‘Times New Roman’]eparately[/font] so I need them to work by themselves.

something like this  
MovieClip.prototype.tweenTo = function(targetsObj, speed, callbackObj, callbackFunc) {  
this.targetsObj = targetsObj;  
this.speed = speed;  
this.callBackObj = callBackObj;  
this.callBackFunc = callBackFunc;  
this.onEnterFrame = function() {  
var count;  
for (var prop in this.targetsObj) {  
this[prop] += (this.targetsObj[prop]-this[prop])/this.speed;  
if (Math.abs(this.targetsObj[prop]-this[prop])\<0.4) {  
this[prop] = this.targetsObj[prop];  
delete this.targetsObj[prop];  
}  
count++;  
}  
if (!count) {  
clip.callBackObjclip.callBackFunc;  
delete this.onEnterFrame;  
}  
};  
};  
var obj = {\_x:200, \_y:200, \_alpha:20, \_height:200, \_width:200};  
mc.tweenTo(obj, 5);

you may have to add more variables if you are wanting different speeds.I`ve adapted this from something else so you may not need the callbackobj,callbackfunc but may be useful to you.

---

<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:** [August 30, 2004, 5:03pm UTC](https://forum.kirupa.com/t/scaling-alpha-position-issues/62686/5 "2004-08-30T17:03:50Z")

</div>

its poor design of the prototypes. They shouldnt set onEnterFrame (a movieclip only gets one, any greedy prototype that sets it will override any existing onEnterFrame, including those set by other greedy prototypes). Instead you should consider dropping the onEnterFrame within the prototype methods and instead have them called within the target clips own onEnterframe

---

<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:** [August 30, 2004, 5:35pm UTC](https://forum.kirupa.com/t/scaling-alpha-position-issues/62686/6 "2004-08-30T17:35:11Z")

</div>

Thanks for the advice. Not to change the issue but I have a problem with this code:

MovieClip.prototype.easeTween = function(targ\_mc, targ2\_mc, mcSpeed, mcX, mcY) {  
this.onEnterFrame = function() {  
targ\_mc.\_width += (mcX-targ\_mc.\_width)/mcSpeed;  
targ\_mc.\_height += (mcY-targ\_mc.\_height)/mcSpeed;  
targ2\_mc.\_x += (mcX-targ\_mc.\_x)/mcSpeed;  
targ2\_mc.\_y += (mcY-targ\_mc.\_y)/mcSpeed;  
};  
};  
box\_mc.onRelease = function() {  
easeTween(box\_mc, box2\_mc, 5, 100, 300);  
};

I am trying to make a menu that stays the exact same space (\_x, \_y) from the top corner of a movie I am scaling. This code o[font=‘Times New Roman’]bviously[/font] doesn’t work. How would I go about doing that.
