[英]MouseEvent.RIGHT_MOUSE_DOWN (“rightMouseDown”) doesn't work in Flex4.6 Web (runs in FlashPlayer)
當我將事件偵聽器添加到Flash Professional CS6中的階段時:
stage.addEventListener(MouseEvent.RIGHT_MOUSE_DOWN, rightMouseHandler);
或沒有常數:
stage.addEventListener("rightMouseDown", rightMouseHandler);
鼠標右鍵工作正常 。 我在Flash Player 11.7(flashplayer_11_sa_debug.exe),Firefox,Chrome,Internet Explorer中對此進行了測試。
但是,當我在Fash Builder 4.6-Flex 4.6應用程序類型Web中編寫此代碼時:
stage.addEventListener("rightMouseDown", rightMouseHandler);
鼠標右鍵不起作用 。
。
改編
與AIR應用程序類型運行相同的Flex項目可使鼠標右鍵正常工作。
關於為什么不能在Flash Player中工作的任何想法?
^^^編輯:^^^我如何添加監聽器:
Flash Builder 4.6:
<s:Application applicationComplete="completeHandler()" ...>
<fx:Script>
<![CDATA[
private function completeHandler(): void {
stage.addEventListener("rightMouseDown", rightMouseHandler);
}
public function rightMouseHandler(e :MouseEvent) :void {
var col :String = '#' + uint(Math.random()*0xFFFFFF).toString(16);
setStyle('backgroundColor', col);
trace(col);
}
1幀中的Flash Professional CS6:
stage.addEventListener("rightMouseDown", rightMouseHandler);
function rightMouseHandler(e :MouseEvent) :void{
var col :uint = uint(Math.random()*0xFFFFFF);
stage.color = col;
trace('#' + col.toString(16));
}
在Flash Builder編譯器選項中,添加更高的swf版本:
-swf-version=15
在偵聽應用程序時(在main.mxml中)觸發事件嗎?
this.addEventListener("rightMouseDown", rightMouseHandler);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.