MouseEvent.RIGHT_MOUSE_DOWN ("rightMouseDown") doesn't work in Flex4.6 Web (runs in FlashPlayer)

StackOverflow https://stackoverflow.com/questions/16896432

سؤال

When I add event listener to stage in Flash Professional CS6:

stage.addEventListener(MouseEvent.RIGHT_MOUSE_DOWN, rightMouseHandler);

or without constant:

stage.addEventListener("rightMouseDown", rightMouseHandler);

right mouse button work ok. I tested this in Flash Player 11.7 (flashplayer_11_sa_debug.exe), Firefox, Chrome, Internet Explorer.


But when I write this in Fash Builder 4.6 - Flex 4.6 application type Web:

stage.addEventListener("rightMouseDown", rightMouseHandler);

right mouse button not working.

.

Remerks

The same Flex project run as AIR application type makes right mouse button work properly.


Any ideas as to why not working in Flash Player?

^^^Edit:^^^ How I adding listener:

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);
            }

Flash Professional CS6 in 1 frame:

stage.addEventListener("rightMouseDown", rightMouseHandler);

function rightMouseHandler(e :MouseEvent) :void{
    var col :uint = uint(Math.random()*0xFFFFFF);
    stage.color = col;
    trace('#' + col.toString(16));
}   
هل كانت مفيدة؟

المحلول

In your Flash Builder compiler options, add a higher swf version:

-swf-version=15 

نصائح أخرى

Is the event fired when listening on application (this on the main.mxml) ?

this.addEventListener("rightMouseDown", rightMouseHandler);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top