3 Replies Latest reply on May 18, 2008 2:13 PM by Ned Murphy

    Getting ComboBox to work in AS3

      Hi All

      Am very new to AS and trying to get a comboBox to work. I copied and pasted the following from the Adobe site in to frame 1:

      // Add Items to List.
      my_cb.addItem({data:1, label:"First Item"});
      my_cb.addItem({data:2, label:"Second Item"});
      my_cb.addItem({data:3, label:"Third Item"});
      my_cb.addItem({data:4, label:"Fourth Item"});

      var cbListener:Object = new Object();
      cbListener.change = function(evt_obj:Object) {
      var item_obj:Object = my_cb.selectedItem;
      var i:String;
      for (i in item_obj) {
      trace(i + ":\t" + item_obj );
      }
      trace("");
      };
      my_cb.addEventListener("change", cbListener);

      I have a comboBox named my_cb on the stage. But when I run it, I get this error: "1118: Implicit coercion of a value with static type Object to a possibly unrelated type Function.