# Right click actions? \[MX\]

**URL:** <https://forum.kirupa.com/t/right-click-actions-mx/23077>\
**Category:** flash\
**Created:** [June 12, 2003, 3:36pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077 "2003-06-12T15:36:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scootman](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@Scootman](https://forum.kirupa.com/u/Scootman)\
**Post date:** [June 12, 2003, 3:36pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/1 "2003-06-12T15:36:45Z")

</div>

Hey, i know this has been asked before, but i couldnt find it anywhere. Is there any way to get an action when you right click your mouse in flash?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 12, 2003, 4:06pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/2 "2003-06-12T16:06:41Z")

</div>

no.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 12, 2003, 4:12pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/3 "2003-06-12T16:12:29Z")

</div>

[http://proto.layer51.com/d.aspx?f=932](http://proto.layer51.com/d.aspx?f=932)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 12, 2003, 5:39pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/4 "2003-06-12T17:39:25Z")

</div>

setInterval(function(){if(Mouse.rightMouseDown^(Mouse.rightMouseDown=Key.isDown(2))) Mouse.rightMouseDown ? Mouse.broadcastMessage(“onRightMouseDown”) : Mouse.broadcastMessage(“onRightMouseUp”);},40);

usage

Mouse Events onRightMouseDown, onRightMouseUp:  
event handlers for right mouse button clicks. Checks  
for these clicks happen every 40 milliseconds.

- In order for these to be recognized, be sure to add your movieclip/object as a listener  
of the mouse object: Mouse.addListener(myObject);

ok… so i put that in my frame in the main timeline… then i do that add listener thing… but how do i actually use it… (sorry ive never used listeners in flash before)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 12, 2003, 5:49pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/5 "2003-06-12T17:49:58Z")

</div>

if you want to set the click for your current timeline, then use something like:

```auto

Mouse.addListener(this);
this.onRightMouseDown = function(){
	trace("Right mouse button pressed");
}
this.onRightMouseUp = function(){
	trace("Right mouse button released");
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 12, 2003, 5:50pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/6 "2003-06-12T17:50:25Z")

</div>

```auto
myObject.onRightMouseDown = callback;
myObject.onRightMouseUp = callback;

```

where callback can be an anonymous function:

```auto
myObject.onRightMouseDown = function() {
trace("right mouse is down");
};

```

or a named function:

```auto
function myFunction() {
trace("right mouse is down");
};
myObject.onRightMouseDown = myFunction;

```

😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 12, 2003, 5:51pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/7 "2003-06-12T17:51:36Z")

</div>

i demand you to delete your post, senocular!! :hair: 😛 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 12, 2003, 6:04pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/8 "2003-06-12T18:04:37Z")

</div>

wow, thats great… thanks a lot you guys…

heh there wouldnt by chance be any way to disable the right click menu eh?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 12, 2003, 6:07pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/9 "2003-06-12T18:07:59Z")

</div>

nope, atleast not online. You can reduce its contents with the publish settings, but its not going away completely

if you are exporting to a projector, there are 3rd party tools that can disable the menu though. I believe screenweaver is one of them.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 12, 2003, 6:14pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/10 "2003-06-12T18:14:55Z")

</div>

well thats pretty cool… i appreciate all the help… but i dont think its gonna work out for what i was trying to make…

im tryin to make movement pretty much like in strategy games… highlight, right click, they move there

i got it with a key press… i thought right click would be cool, but with the menu i dont think it will work out…

anyway heh if you wanna see what ive done so far here it is… [http://www.freewebs.com/scottgilmore/selector.html](http://www.freewebs.com/scottgilmore/selector.html) you push the space bar to make them move to where the mouse is (i need to fix it so they wont overlap eachother

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 12, 2003, 6:38pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/11 "2003-06-12T18:38:57Z")

</div>

I often use something liek Shift+Click. Might be an alternative

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 12, 2003, 6:57pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/12 "2003-06-12T18:57:13Z")

</div>

hmm i think ill try that…  
thanks again

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 1, 2003, 3:19pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/13 "2003-07-01T15:19:28Z")

</div>

In simple terms, for a total newbie here, if I want to open a pop-up window using a right click instead of a left click, how do I integrate the following javascript call with the stuff mentioned above?

getURL(“javascript:openNewWindow(‘picture1.htm’,‘Picture’,‘height=480,width=777,toolbar=no,resizable=no,scrollbars=no’)”);

Something simple would be appreciated, like paste this here & paste that there, please.

I’m getting my head around all this slowly, but my project can’t wait for my head :\*(

Thanks

Martin

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 2, 2003, 5:27am UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/14 "2003-07-02T05:27:57Z")

</div>

```auto
setInterval(function () {
	if (Mouse.rightMouseDown ^ (Mouse.rightMouseDown=Key.isDown(2))) {
		Mouse.rightMouseDown ? Mouse.broadcastMessage("onRightMouseDown") : Mouse.broadcastMessage("onRightMouseUp");
	}
}, 40);
myObj = new Object();
myObj.onRightMouseDown = function() {
	getURL("java **** script:openNewWindow('picture1.htm','Picture','height=480,width=777,toolbar=no,resizable=no,scrollbars=no');");
};
Mouse.addListener(myObj);

```

??

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 3, 2003, 8:16am UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/15 "2003-07-03T08:16:15Z")

</div>

This puzzles me…

To make this work with the right-click of a button, I would have expected the code to start with and event handler, like

" onRightMouseDown(…"

The code above seems to be either incomplete or I’m not putting it in the right place.

More help neded please

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 3, 2003, 3:56pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/16 "2003-07-03T15:56:11Z")

</div>

the code is not incomplete, you’re supposed to paste the it in the frame actions.

however, the code will be triggered whenever you right click over your movie. to make it work like an onPress handler, you could try this:

```auto
setInterval(function () {
	if (Mouse.rightMouseDown ^ (Mouse.rightMouseDown=Key.isDown(2))) {
		Mouse.rightMouseDown ? Mouse.broadcastMessage("onRightMouseDown") : Mouse.broadcastMessage("onRightMouseUp");
	}
}, 40);
Button.prototype.hitTest = MovieClip.prototype.hitTest;
myButton.onRightMouseDown = function() {
	if (this.hitTest(this._parent._xmouse, this._parent._ymouse, true)) {
		getURL("java****script:openNewWindow('picture1****.htm','Picture','height=480,width=777,toolbar=no,resizable=no,scrollbars=no');");
	}
};
Mouse.addListener(myButton);

```

that should do… =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 4, 2003, 12:45am UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/17 "2003-07-04T00:45:44Z")

</div>

am i reading that right?? the key code is 0x000002 for a right mouse click??? how did whoever discovered that discover that?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 4, 2003, 12:52am UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/18 "2003-07-04T00:52:03Z")

</div>

It works!! That is the most amazing thing I have ever seen.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 4, 2003, 11:18am UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/19 "2003-07-04T11:18:13Z")

</div>

Hi Kax

Please excuse my ignorance, but I copied an pasted your script into the AS for my button, but I get the following error messages when testing the movie:

Symbol=rotographic, Layer=button, Frame=4: Line 13: Statement must appear within on handler  
setInterval(function () {

Symbol=rotographic, Layer=button, Frame=4: Line 18: Statement must appear within on handler  
Button.prototype.hitTest = MovieClip.prototype.hitTest;

Symbol=rotographic, Layer=button, Frame=4: Line 21: String literal was not properly terminated  
getURL("javascript:openNewWindow(‘picture1. htm’,‘Picture’,'height=480,width=777,toolbar=no,re

Symbol=rotographic, Layer=button, Frame=4: Line 22: ‘)’ or ‘,’ expected  
sizable=no,scrollbars=no’);");

Symbol=rotographic, Layer=button, Frame=4: Line 23: ‘;’ expected  
}

Symbol=rotographic, Layer=button, Frame=4: Line 19: Statement must appear within on handler  
myButton.onRightMouseDown = function() {

Symbol=rotographic, Layer=button, Frame=4: Line 25: Statement must appear within on handler  
Mouse.addListener(myButton);

The intention was to share the button with the following script which enlarges / shrinks the thumbnail image on left clicks.

on (press) {  
if (out) {  
\_parent.pressv=-2;  
out=false;

} else {  
\_parent.pressv=2;  
out=true;  
}  
}

So you can see what I want to do, left clicks enlarge and shrink the thumbnail size, right-clicks bring up a pop-up window with the full sized image.

What I need to have is the script which I can put in place of the existing script to achieve this goal.

Thanks for your help.

Martin

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 4, 2003, 9:55pm UTC](https://forum.kirupa.com/t/right-click-actions-mx/23077/20 "2003-07-04T21:55:41Z")

</div>

you put that code in the frame actions, not the button actions.

[Next page](https://forum.kirupa.com/t/right-click-actions-mx/23077.md?page=2)
