In the beginning of sen’s 3d tutorial, there’s an example of 3 guys moving back and forth and resizing so they look as if they are 3d…they move back and fourth with this function:
[AS]
backAndForth = function(){
this.z += speed*this.dir;
if (this.z > 500){
this.z = 500;
this.dir = -1;
}else if (this.z < 0){
this.z = 0;
this.dir = 1;
}
var scaleRatio = focalLength/(focalLength + this.z);
this._x = origin.x + this.x * scaleRatio;
this._y = origin.y + this.y * scaleRatio;
this._xscale = this._yscale = 100 * scaleRatio;
this.swapDepths(-this.z);
};
[/AS]
then they are moved with this:
[AS]
figureA.onEnterFrame = backAndForth;
figureB.onEnterFrame = backAndForth;
figureC.onEnterFrame = backAndForth;
[/AS]
what i want to do is change the movement function into 2 seperate parts, back and forth, and set it up so you have to click a guy to get him to come foward, then click him again to send him back?
i’ve tried…but it’s not working out, any help?