dimanche 29 novembre 2015

actionscript 3 :error. type coercion failed

I am getting following error when trying to simulate CalendarLayoutChangeEvent on a DateField object.

cannot convert mx.events::CalendarLayoutChangeEvent@feb667 to mx.events.CalendarLayoutChangeEvent

I am dispatching events on swf's which are loaded at runtime.

any help will be appreciated.

private function setDateField(child:Object, dateString:String):String
{                   
    child.selectedDate = compileDateValue(dateString,child.formatString);
    var changeEvent:CalendarLayoutChangeEvent = new CalendarLayoutChangeEvent("change", true, false, null, new Event("change"));
    var retval:String;
    try
    {
        retval = String(child.dispatchEvent(changeEvent));
    }
    catch(e:Error)
    {   
        trace(e);
    }
    return retval;
}

Aucun commentaire:

Enregistrer un commentaire