# Getting variable value from a function to out side the function in as3

**URL:** <https://forum.kirupa.com/t/getting-variable-value-from-a-function-to-out-side-the-function-in-as3/326929>\
**Category:** flash\
**Created:** [January 23, 2012, 10:44am UTC](https://forum.kirupa.com/t/getting-variable-value-from-a-function-to-out-side-the-function-in-as3/326929 "2012-01-23T10:44:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandeep\_hcie](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@sandeep\_hcie](https://forum.kirupa.com/u/sandeep_hcie)\
**Post date:** [January 23, 2012, 10:44am UTC](https://forum.kirupa.com/t/getting-variable-value-from-a-function-to-out-side-the-function-in-as3/326929/1 "2012-01-23T10:44:42Z")

</div>

Hi all,  
i’m newbie in as3… please help me that how to get variable value from a function to a text box here is the code :

import fl.controls.ComboBox;  
import flash.events.Event;  
import flash.events.MouseEvent;  
TxtAnswer = Array();

//-----------------------------------  
a1.addEventListener(Event.CHANGE,myObject1);

a1.addItem({label:“sandeep”});  
a1.addItem({label:“anish”});  
a1.addItem({label:“prasanth”});  
a1.addItem({label:“vishnu”});

function myObject1(event:Event):void{  
var sk1 = a1.selectedItem.label;

}

… i want that variable “sk1” to next scene text box …  
i putted the code like this :  
q1.text = sk1;

but it is not working…  
if anybody knows that please help me …

Thanks in advance 🙂  
Sandeep AR
