# How to retrive value out of a function?

**URL:** <https://forum.kirupa.com/t/how-to-retrive-value-out-of-a-function/304563>\
**Category:** Uncategorized\
**Created:** [February 10, 2010, 2:06am UTC](https://forum.kirupa.com/t/how-to-retrive-value-out-of-a-function/304563 "2010-02-10T02:06:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mick\_special](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@mick\_special](https://forum.kirupa.com/u/mick_special)\
**Post date:** [February 10, 2010, 2:06am UTC](https://forum.kirupa.com/t/how-to-retrive-value-out-of-a-function/304563/1 "2010-02-10T02:06:58Z")

</div>

i want the value of “newAngle” to be accessible outside of this function.

I am doing something dumb i’m sure…

```auto
function aim(e:MouseEvent):void
{
    adj = mouseX - gun_mc.x;
    opp = mouseY - gun_mc.y;
    angle = Math.atan2(opp, adj)/(Math.PI/180);
    newAngle = angle + 90;
    
    if (newAngle < -70)
    {
        newAngle = -70
    }
    if (newAngle > 70)
    {
        newAngle = 70
    }
    
    
    
    if (angle <= -20 && angle >= -160)
    {
    gun_mc.rotation = angle + 90;
    }
    if (angle < -20)
    {
        angle = -20
    }
    if (angle > -160)
    {
        angle = -160
    }
    
    
}

trace(newAngle);

```
