hello,
if i have a movie clip with those X,Y cordinate (100,100) and i want him to go to (300,200) but i want to see him "walking" till he reach the location with a constant speed .
how can i do it ?
thank you
There are a couple ways you can move an object using actionscript.
One is to use the Tween class or a third party tweening class such as Tweenlite.
Another is to use enterFrame processing to have the object's _X and _y coordinates gradually increase to the final values at constant increments (in the sample code below "yourMC would be replaced with the instance name of your movieclip).
var stepsize = 2; // adjust as desired for speed
this.onEnterFrame = function(){
if(yourMC._x >= 300){
delete this.onEnterFrame;
} else {
yourMC._x += 2*stepsize;
yourMC._y += stepsize;
}
}
As far as the walking goes, you would need to have the movieclip do the animation of the stepping.
North America
Europe, Middle East and Africa
Asia Pacific