marbel82
marbel82

Reputation: 948

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

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

Upvotes: 0

Views: 470

Answers (2)

flexicious.com
flexicious.com

Reputation: 1671

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

-swf-version=15 

Upvotes: 1

Jim_Nastiq
Jim_Nastiq

Reputation: 41

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

this.addEventListener("rightMouseDown", rightMouseHandler);

Upvotes: 0

Related Questions