Welcome to my actionscript snippet library!

Actionscript Snips is a small repository of actionscript code that aims to save developers and designers time when developing a website.  

Populate ComboBox

Drag an instance of a combo box onto the stage and give it an instance name.

import flash.events.Event;
import fl.data.DataProvider;

var colors:Array = new Array();
colors[0] = "red";
colors[1] = "blue";
colors[2] = "green";
colors[3] = "yellow";
colors[4] = "purple";

comboBox.dataProvider = new DataProvider(colors);
comboBox.addEventListener(Event.CHANGE, onChange);

function onChange(e:Event):void {
trace(e.target.value);
}

0 comments:

Post a Comment