A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] Combibox change event

  1. #1
    Senior Member somlemeg's Avatar
    Join Date
    Aug 2000
    Posts
    171

    resolved [RESOLVED] Combibox change event

    How can I make this syntax right, have:

    Code:
    package
    {
    	import Array;
    	import fl.data.DataProvider;
    	import fl.controls.ComboBox; 
    	import fl.events.ComponentEvent;
    
    	import flash.display.Sprite;
    	
    	
    	public class SettingsMenu extends Sprite 
    	{
    		public function SettingsMenuInit () : void
    		{
    			var items : Array = [ 
    			{
    				label : "option1", data : "screenData1"
    			},
    			{
    				label : "option2", data : "screenData2"
    			},];
    			myCombBox.dataProvider = new DataProvider (items);
    			myCombBox.addEventListener(Event.CHANGE, newSelection);
    			function newSelection (e:ComponentEvent) : void
    			{
    				//trace (myCombBox(e.target).selectedItem.data);
    			}
    		}
    	}
    }
    myCombBox is a combi box component.

    The problem is when adding the event listner to the combi box.

    I get this errors:
    1120: Access of undefined property Event.

    I don't know what class to import or if there is something else wrong in the syntax.

  2. #2
    Senior Member somlemeg's Avatar
    Join Date
    Aug 2000
    Posts
    171
    Found the answer, forgot to import flash.events.Event.

    Instead of e:ComponentEvent used e:Event.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center