Calculate Kilometers

My car is moving on a maze.

The movement of car is through Arrow keys.

**I have to calculate KM. **i.e., the distance travelled.

Please help.

Here is the script

onClipEvent (enterFrame) {

    with (_root.car) {
        if (Key.isDown(40)) {
            _y = _y+3;
         
        }
        // end if               
        if (Key.isDown(38)) {
            _y = _y-3;
          
        }
        // end if               
        if (Key.isDown(37)) {
            _x = _x-3;
          
        }
        // end if               
        if (Key.isDown(39)) {
            _x = _x+3;
         
        }
        // end if               
        // end if 
        if (walls.hitTest(getBounds(_root).xMax, _y, true)) {
            _x = _x-3;
        }
        // end if               
        if (walls.hitTest(getBounds(_root).xMin, _y, true)) {
            _x = _x+3;
        }
        // end if               
        if (walls.hitTest(_x, getBounds(_root).yMax, true)) {
            _y = _y-3;
        }
        // end if               
        if (walls.hitTest(_x, getBounds(_root).yMin, true)) {
            _y = _y+3;
        }
        // end if               
        if (_root.goal.hitTest(_x, getBounds(_root).yMax, true)) {
            _root.gotoAndStop(3);
        }
        // end if               
    }
    // End of with

}

how far is a KM? since your using px you can say 1km = 90px or something to that affect and eachtime you move
movedDistance = movedDistance+3 //3 is howmany px it moves
then km = movedDistance/90
its all dependent on the scale your using…
if you have 20fps and you hold right for 1 second it moves 3px*20 or 60px so just decide how many px in a km and use it

Current fps is 20 and and the distance travelled 80px = 1km