3 Replies Latest reply on May 4, 2011 7:18 AM by UbuntuPenguin

    Dispatching change event for Colorpicker from AS3

    pgpradeep

      Hi,

       

      I am using AS3.0.

      I want to change the color of a colorpicker programmatically.

      I am doing this by directly setting the "selectedColor" property and then am trying to dispatch a change event.

       

      The code is here:

       

      //colPicker is the ColorPicker object;

      colPicker["selectedColor"] = 10079232;

      colPicker.dispatchEvent(new ColorPickerEvent(ColorPickerEvent.CHANGE));//mx API

       

      The color is changong,but I am getting the following error for the dispatchEvent:

      Error #1034: Type Coercion failed: cannot convert mx.events::ColorPickerEvent@c90aa89 to mx.events.ColorPickerEvent.

       

      If,however, I also try:

      colPicker.dispatchEvent(new Event(Event.CHANGE));//flash API

       

      I get the following error:

      Error #1034: Type Coercion failed: cannot convert flash.events::Event@c95d8e1 to mx.events.ColorPickerEvent.

       

      As Alex HarUI said in one of my earlier posts, this is bcoz Im trying to integrate the Flex framework with a non-Flex classes.

       

      So, I want to know how to dispatch a CHANGE event for ColorPicker from AS3.

       

      Thanks,

      Pradeep.