# Changing Variable (dataType Function) with a comboBox

**URL:** <https://forum.kirupa.com/t/changing-variable-datatype-function-with-a-combobox/263211>\
**Category:** flash\
**Created:** [June 13, 2008, 11:40am UTC](https://forum.kirupa.com/t/changing-variable-datatype-function-with-a-combobox/263211 "2008-06-13T11:40:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Huwman](https://avatars.discourse-cdn.com/v4/letter/h/d9b06d/32.png) [@Huwman](https://forum.kirupa.com/u/Huwman)\
**Post date:** [June 13, 2008, 11:40am UTC](https://forum.kirupa.com/t/changing-variable-datatype-function-with-a-combobox/263211/1 "2008-06-13T11:40:17Z")

</div>

Platform : Flash CS3, AS3

Hi, I hope this will be an easy problem for some of you.

I have a variable (**easeType)** sat in a Class called **dragClip**  
it’s set within the class like so;

```auto
public var easeType:Function = Elastic.easeOut;

```

this variable changes the type of easing of the class when it uses a tweening method.

I want to use a comboBox on the Stage to change the value of this variable, so that the class eases in the way specified by the comboBox. I have it populated with options like **Bounce.easeOut** and **Strong.easeOut**

On the timeline, I have this code;

```auto

function changeHandler(e:Event):void {
    var cb:ComboBox = e.currentTarget as ComboBox;
    var fn:Function = getDefinitionByName(cb.selectedLabel] as Function ;   
    dragClip.easeType = fn;
}
 
easePicker.addEventListener(Event.CHANGE, changeHandler);

```

Unfortunately, when I select anything in the comboBox, I get this error;

> 

ReferenceError: Error #1065: Variable easeOut is not defined.  
at global/flash.utils::getDefinitionByName()

I assume the problem is because of the dot between (for example) S_trong_ and _easeOut_ but I don’t really know where to go from here.

---

<div class="post-metadata">

**Author:** ![Huwman](https://avatars.discourse-cdn.com/v4/letter/h/d9b06d/32.png) [@Huwman](https://forum.kirupa.com/u/Huwman)\
**Post date:** [June 13, 2008, 12:57pm UTC](https://forum.kirupa.com/t/changing-variable-datatype-function-with-a-combobox/263211/2 "2008-06-13T12:57:02Z")

</div>

Ok, I have a work around now, which gives the desired effect but is not ideal. So if anyone has the proper solution, please contribute too.

```auto

 
import fl.transitions.easing.*;
 
var easeArray = new Array(Elastic.easeOut,Regular.easeOut,Strong.easeOut,Bounce.easeOut,Back.easeOut)

function changeHandler(e:Event):void {
    var cb:ComboBox = e.currentTarget as ComboBox;
    var sel:uint = cb.selectedIndex;
    dragClip.easeType = easeArray[sel]; 
}
 

```

The fact is that the array is a repetition of the data in the comboBox, so it’s a bit redundant. It works, though.
