example: add a label and a combo box on the stage then delete them (will remain in the library). then:
objComboListener = new Object();
objComboListener.change = function(eventObj){
my_lbl.text = eventObj.target.text;
trace(my_lbl.text);
}
this.createClassObject(mx.controls.ComboBox, "my_cb", 1, {_x:10, _y:10});
this.createClassObject(mx.controls.Label, "my_lbl", 2, {_x:10, _y:40});
my_cb.addItem("JAN", 0);
my_cb.addItem("FEB", 1);
my_cb.addItem("MAR", 2);
my_cb.addItem("APR", 3);
my_cb.addItem("MAY", 4);
my_cb.addItem("JUN", 5);
my_lbl.text = "Jan";
my_cb.addEventListener("change", objComboListener);
stop();
- objComboListener = new Object();
- objComboListener.change = function(eventObj){
- my_lbl.text = eventObj.target.text;
- trace(my_lbl.text);
- }
- this.createClassObject(mx.controls.ComboBox, "my_cb", 1, {_x:10, _y:10});
- this.createClassObject(mx.controls.Label, "my_lbl", 2, {_x:10, _y:40});
- my_cb.addItem("JAN", 0);
- my_cb.addItem("FEB", 1);
- my_cb.addItem("MAR", 2);
- my_cb.addItem("APR", 3);
- my_cb.addItem("MAY", 4);
- my_cb.addItem("JUN", 5);
- my_lbl.text = "Jan";
- my_cb.addEventListener("change", objComboListener);
- stop();
This will create a combo box filled with Jan to Jun months, and on change, it will change the label text to the selected item.
The rest about em ... in flash help -> Using Components section.
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”