我創建了一個自定義的MouseEvent中的Flex:FLEX,Actionscript:我如何調用CustomEvent?
package {
import flash.events.MouseEvent;
public class CustomMouseEvent extends MouseEvent {
public var tags:Array = new Array();
public function CustomMouseEvent(type:String, tags:Array) {
super(type, true);
this.tags = tags;
}
}
}
現在我想了解如何從ActionScript和MXML傳遞參數標籤:
從ActionScript我想這樣的事情,但它不工作:
newTag.addEventListener(MouseEvent.MOUSE_UP, dispatchEvent(new CustomMouseEvent(MouseEvent.MOUSE_UP,[newTag.name])));
從MXML我這樣做,並沒有工作,以及:
<mx:LinkButton click="dispatchEvent(new CustomMouseEvent(MouseEvent.MOUSE_UP, bookmarksRepeater.currentItem.tags))" />
感謝
你得到了什麼錯誤? – oedo 2010-05-05 14:59:33
爲什麼你讓你的類擴展MouseEvent?如果你創建一個擴展Event的類,我會認爲它更容易,也更清晰。 (而且我猜你會更好,如果你定義了你自己的事件名稱,並且在這種情況下不使用MOUSE_UP) – 2010-05-05 16:22:36
好吧,我現在正在擴展事件 – aneuryzm 2010-05-05 18:32:14