# Returning varibales from event handler functions

**URL:** <https://forum.kirupa.com/t/returning-varibales-from-event-handler-functions/292318>\
**Category:** flash\
**Created:** [July 13, 2009, 10:25am UTC](https://forum.kirupa.com/t/returning-varibales-from-event-handler-functions/292318 "2009-07-13T10:25:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![romit\_2034](https://avatars.discourse-cdn.com/v4/letter/r/ed655f/32.png) [@romit\_2034](https://forum.kirupa.com/u/romit_2034)\
**Post date:** [July 13, 2009, 10:25am UTC](https://forum.kirupa.com/t/returning-varibales-from-event-handler-functions/292318/1 "2009-07-13T10:25:02Z")

</div>

Hey,

Look at my code below

import fl.transitions.Tween;  
import fl.transitions.easing.\*;  
var id:Number;

next\_btn.addEventListener(MouseEvent.CLICK, goNext);  
function goNext(event:MouseEvent):void{  
var num = test\_mc.x;  
var fadeTween = new Tween(test\_mc,“x”,Regular.easeInOut,num, num- 530.8,0.5,true);  
id = test\_mc.width - 530.8;  
trace(id);

}

The variable id which is declared globally is changed in the function goNext. I need the variable to retain the value, but it gets reset as the function is not returning. I tried the return method but that’s not working either. Please Help.
