shuga
February 12, 2003, 5:06am
1
i would like to have a movieclip set to a certain size that is kept in a variable then on mouse over i would like the movieclip’s _xscale and _yscale to increase by 20 with easing and maybe a lil bounce. i can’t really figure it out though all i can get is
function(MCenlarge){
myMovieClip._xscale+=20;
myMovieClip._yscale+=20;
}
your help is greatly appreciated
system
February 12, 2003, 5:20am
2
Use the easing tutorial but change _x and _y to _xscale and _yscale
system
February 12, 2003, 5:27am
3
it doesn’t work
function(MCenlarge){
speed = 8;
endX = this._xscale+20;
endY = this._yscale+20;
_xscale += (endX-_xscale)/speed;
_yscale += (endY-_yscale)/speed;
}
then i call it with this on the button
on(rollOver){
this.MCenlarge();
}
system
February 12, 2003, 5:44am
4
Your function is written wrong for one.
It is function nameOfFunction(){ }
You can’t use “this” within a function.
I don’t think you need _xscale and _yscale in the endX and endY
So your function should look like this…
function MCenlarge() {
speed = 8;
endX = 20;
endY = 20;
_xscale += (endX-_xscale)/speed;
_yscale += (endY-_yscale)/speed;
}
And to call it, you use _root, not “this”…
on (rollOver) {
_root.MCenlarge();
}
I didn’t test it, but those could be some things that are wrong.
system
February 12, 2003, 5:46am
5
And looking at it again… you define to enterframe so it will just contantly jump to a point.
system
February 12, 2003, 5:48am
6
it doesn’t do it still … it just get’s smaller and smaller … no easing … just jumps to the scale value
system
February 12, 2003, 6:04am
7
As my previous post stated, you define to onEnterFrame for it to keep working with.
Try using a prototype instead (since you can use “this” with a prototype). Something like this…
MovieClip.prototype.MCenlarge = function(endWidth, endHeight) {
this.speed = 8;
this.endX = endWidth;
this.endY = endHeight;
this.onEnterFrame = function() {
this._xscale += (this.endX-this._xscale)/this.speed;
this._yscale += (this.endY-this._yscale)/this.speed;
};
};
Then on your button (which also has to be a movie clip I believe), do this…
on (rollOver) {
this.MCenlarge(30, 30);
}
on (rollOut) {
this.MCenlarge(100, 100);
}
The first number there is the _xscale value and the second number there is the the _yscale value.
system
February 12, 2003, 8:29am
8
savin me as always. thanks beta
system
February 12, 2003, 8:30am
9
No problem It is my pleasure!