# Senocular 3d tut question

**URL:** <https://forum.kirupa.com/t/senocular-3d-tut-question/101479>\
**Category:** Uncategorized\
**Created:** [February 10, 2004, 11:00am UTC](https://forum.kirupa.com/t/senocular-3d-tut-question/101479 "2004-02-10T11:00:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![macneilslt](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@macneilslt](https://forum.kirupa.com/u/macneilslt)\
**Post date:** [February 10, 2004, 11:00am UTC](https://forum.kirupa.com/t/senocular-3d-tut-question/101479/1 "2004-02-10T11:00:28Z")

</div>

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?
