i am newbie around in flash. i have written a code for move an object (button instance). but my problem is its instantaneous. i want it to move in a smooth motion (something like tweening). i have tried for loops and stuff… but i have not been able to smoothen the motion.
the code is as follows
[AS]
on (rollOver) {
speed = 2;
finalx = contactbutton._x + 100;
finaly = contactbutton._y + 100;
contactbutton._x += (finalx - contactbutton._x)/speed;
}
[/AS] :hair:
i checked out the link and made modifications to the script. i’m placing my script below: actually, i have tried using ‘easing’ only the x values for a start
[AS]
on (rollOver) {
/ get original x and y position /
xpos = this.contactbutton._x;
ypos = this.contactbutton._y;
speed = 3;
/calculate final x & y position /
finalX = xpos + 100;
finalY = ypos + 100;
onEnterFrame = function() {
differenceX = finalX - this.contactbutton._xscale;
differenceY = finalY - this.contactbutton._yscale;
if (Math.floor(differenceX == 0)) {
delete.this.onEnterFrame;
} else {
contactbutton._xscale += differenceX /speed;
}
}
}
[/AS]
did i mention before that this is a button and not a movie clip!!!