# Problem subtracting one variable from another

**URL:** https://forum.kirupa.com/t/problem-subtracting-one-variable-from-another/188607
**Category:** flash
**Created:** [May 9, 2006, 12:10pm UTC](https://forum.kirupa.com/t/problem-subtracting-one-variable-from-another/188607 "2006-05-09T12:10:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![pcurrid](https://avatars.discourse-cdn.com/v4/letter/p/e95f7d/32.png) [@pcurrid](https://forum.kirupa.com/u/pcurrid)
#### Post date: [May 9, 2006, 12:10pm UTC](https://forum.kirupa.com/t/problem-subtracting-one-variable-from-another/188607/1 "2006-05-09T12:10:57Z")

</div>

Hi guys,  
I’m having some problems subtracting one variable from another.  
Both are number variables.  
The 1st variable comes from a getTimer, when the Space bar is hit  
the 2nd variable also from a getTimer, the time when a movie is at a certain coordinate.  
CameraView is a car movie, and collision is basically a movie that the user has to break (hit Spacebar), and their reaction time is measured.  
I just know I’ve done something silly!  
Any help would be greatly appreciated

Here is the code:

obstacle = function(){  
zposition = cameraView.z;  
xposition = cameraView.x;

```
    if (cameraView.x &gt;=-450 and cameraView.x &lt;=450 and cameraView.z &gt;=3000 and camera.z &lt;=3500){
        collision.x = 0;
        collision.z = 3500;
        collision.y = 20;
        
        if (collision.x==0 and collision.z==3500){
        var timercollision:Number =getTimer();
        obstacle = timercollision;
        var diff:Number = (timer - timercollision);
        difference.text = diff;
        }
    }

```

}  
cameraView.onEnterFrame = obstacle;
