Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 动作脚本3:错误。类型强制失败_Actionscript 3_Apache Flex_Flex4.5 - Fatal编程技术网

Actionscript 3 动作脚本3:错误。类型强制失败

Actionscript 3 动作脚本3:错误。类型强制失败,actionscript-3,apache-flex,flex4.5,Actionscript 3,Apache Flex,Flex4.5,尝试在日期字段对象上模拟CalendarLayoutChangeEvent时出现以下错误 无法转换 mx.events::CalendarLayoutChangeEvent@feb667到 mx.events.CalendarLayoutChangeEvent 我正在调度运行时加载的swf上的事件 任何帮助都将不胜感激 private function setDateField(child:Object, dateString:String):String {

尝试在
日期字段
对象上模拟
CalendarLayoutChangeEvent
时出现以下错误

无法转换 mx.events::CalendarLayoutChangeEvent@feb667到 mx.events.CalendarLayoutChangeEvent

我正在调度运行时加载的swf上的事件

任何帮助都将不胜感激

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;
}

你能给我们看一下你使用的代码吗?这个代码来自主swf,我正在加载的应用程序swf的DateField对象上调度事件。我测试了你的代码(做了一些编辑),没有发现任何错误!在stage中插入一个
日期字段可以正常工作……我认为,这个问题与不同的应用程序域有关。在主swf文件中,在运行时加载多个swf文件。通过这种方式,我可以将加载的应用程序上的事件模拟到主swf中。您是如何在主swf中加载这些swf的?调用
setDateField()
函数时,子对象是否为
DateField
对象。。。