mde / flex-pilot

Testing automation library for Flex and Flash.
55 stars 30 forks source link

issue calling select function on spark.components.DropDownList #10

Open mariangemarcano opened 13 years ago

mariangemarcano commented 13 years ago

getting the following error when calling the function function select(params:Object) using a label=newvalue

TypeError: Error #1034: Type Coercion failed: cannot convert org.flex_pilot.events::FPListEvent@15476fc9 to spark.events.IndexChangeEvent.

this occurs when the code is on this line
if (sel[labelField] != targetLabel) { Events.triggerListEvent(obj, ListEvent.CHANGE);

on the function select(params:Object) (FPController.as)

complete stack

TypeError: Error #1034: Type Coercion failed: cannot convert org.flex_pilot.events::FPListEvent@15476fc9 to spark.events.IndexChangeEvent. at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent() at org.flex_pilot.events::Events$/triggerListEvent()[E:\Source\xx\Flex\xx\src\org\flex_pilot\events\Events.as:182] at org.flex_pilot::FPController$/select()[E:\Source\xx\Flex\xx\src\org\flex_pilot\FPController.as:496] at Function/http://adobe.com/AS3/2006/builtin::apply() at Function/()[E:\Source\xx\Flex\xx\src\org\flex_pilot\FlexPilot.as:138] at Function/http://adobe.com/AS3/2006/builtin::apply() at flash.external::ExternalInterface$/_callIn() at Function/()

any idea on how to select an item using this element?

mariangemarcano commented 13 years ago

I just commented the called to the event as shown below and it is working on my end (it is changing the selectedItem to the new value without throwing any error), not sure what will be the proper fix for this.

      if(labelField in sel){
        if (sel[labelField] != targetLabel) {
        // Events.triggerListEvent(obj, ListEvent.CHANGE);
          for each (item in obj.dataProvider) {
            if (item[labelField] == targetLabel) { 
              obj.selectedItem = item;
            }
          }
        }
      }