Tôi có một lớp cơ bản:Flex Loại Cưỡng chế, nó đã biến mất tinh thần tôi nghĩ
public class WindowEvent extends Event
{
public static const WARNEVENT:String = "warnEvent";
public static const TASKREQEVENT:String = "taskRequestEvent";
public static const TASKANNOUNCE:String = "taskAnnounce";
public static const WINDOWCHANGE:String = "windowChange";
public static const ILLEGALPOSITION:String = "illegalPosition";
// insert brevity
}
Bốn sự kiện đầu tiên được làm việc tốt, nhưng tôi chỉ tôi thêm ILLEGALPOSITION
và cố này:
// inside Window.as
private function checkDimensions():void {
if(!Window._legalBoundaryEnable)
return;
... var pass:Boolean = Window.legalBoundary.containsRect(
455 this.getBounds(stage));
456 if(!pass) {
457 this.dispatchEvent(new WindowEvent(WindowEvent.ILLEGALPOSITION,
... "Illegal Position etc."));
}
}
Vì vậy, Flex đã tăng cường ngăn xếp này cho tôi khi tôi nhấn vào phương thức công văn:
TypeError: Error #1034: Type Coercion failed: cannot convert ¬ flex.utils.ui::[email protected] to flash.events.MouseEvent. at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent() ¬ [C:\autobuild\~\UIComponent.as:9298] at flex.utils.ui::Window/checkDimensions()[C:\Users\~\Window.as:457] at flex.utils.ui::Window/stageResized()[C:\Users\~\Window.as:220]
Như bạn có thể thấy từ dấu vết, Window.as:457
là dòng mã người dùng cuối cùng. Vì vậy, WTF là flash.events.EventDispatcher.dispatchEventFunction
cố gắng để làm với một MouseEvent
?
Tôi đã sao chép một hàm listener và bạn đã đúng, kiểu tham số là
MouseEvent
. Thực sự là một sai lầm ngớ ngẩn, phải không. –/lấy nó, bạn không thể sử dụng thẻ trong ý kiến. –