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
对象。。。