function Drag(event:MouseEvent):void {
if ((event.target.parent == InventoryMenu) && (event.target is item)) {
var picked:item = item(event.target);
stage.addEventListener(MouseEvent.MOUSE_UP, Drop);
InventoryArrowDown.addEventListener(MouseEvent.MOUSE_OVER, InventoryNav("down"));
InventoryArrowUp.addEventListener(MouseEvent.MOUSE_OVER, InventoryNav("up"));
function Drop(event:MouseEvent):void {
if ((event.target.parent == InventoryMenu) && (event.target is item)) {
var dropped:item = item(event.target);
if ((event.target is item) && (event.target.parent == InventoryMenu)) {
if (picked.itemdata("workswith") == dropped.name) {
var itemname:item = item(FetchResult(picked, dropped));
itemname.addChild(itemname.itemdata("filename"));
InventoryMenu.removeChild(picked);
InventoryMenu.removeChild(dropped);
InventoryMenu.addChild(itemname);
InventoryUpdate();
} else if (picked.name != dropped.name) {
trace("No son compatibles");
}
stage.removeEventListener(MouseEvent.MOUSE_UP, Drop);
InventoryArrowDown.removeEventListener(MouseEvent.MOUSE_OVER, InventoryNav("down"));
InventoryArrowUp.removeEventListener(MouseEvent.MOUSE_OVER, InventoryNav("up"));
}
}
}
}
}
由于某种原因,InventoryArrowDown 和 InventoryArrowUp 上的 removeEventListener 不起作用。我相当确定路由是正确的,因为它是从 addEventListener 直接复制粘贴的,并且它不使用任何变量。
任何线索有什么问题?