You can fake it though.. Here's a class I wrote a while ago.
And here you find a demo:
http://www.mediamonkey.nl/flashfiles/MouseDetection.html
/** MouseDetection.as
* @Author: Bart "Mediamonkey" Wttewaall
* @Date: 31-10-2005
* @Description:
* A class that tests throug an interval if the left, middle or right
mousebutton is up or down.
* It returns an event that can be listened to through the EventDispatcher.
*
* Usage:
import MouseDetection;
import mx.utils.Delegate;
var MD = new MouseDetection();
MD.addEventListener(MouseDetection.LEFT_DOWN, Delegate.create(this, write));
MD.addEventListener(MouseDetection.LEFT_UP, Delegate.create(this, write));
MD.addEventListener(MouseDetection.RIGHT_DOWN, Delegate.create(this, write));
MD.addEventListener(MouseDetection.RIGHT_UP, Delegate.create(this, write));
MD.addEventListener(MouseDetection.MIDDLE_DOWN, Delegate.create(this, write));
MD.addEventListener(MouseDetection.MIDDLE_UP, Delegate.create(this, write));
MD.addEventListener(MouseDetection.DOUBLE, Delegate.create(this, doubleclick));
MD.addEventListener(MouseDetection.SCROLL, Delegate.create(this, scroll));
function write(evt:Object) {
trace(evt.target+" = "+evt.isDown);
}
function doubleclick(evt:Object) {
trace(evt.target+" doubleclick: "+evt.value+" ms");
}
function scroll(evt:Object) {
trace(evt.target+" = "+evt.value);
}
*/
import mx.utils.Delegate;
import mx.events.EventDispatcher;
class MouseDetection {
// static event variables. call these as listenernames.
static public var LEFT_DOWN:Number = 1 << 0;
static public var LEFT_UP:Number = 1 << 1;
static public var RIGHT_DOWN:Number = 1 << 2;
static public var RIGHT_UP:Number = 1 << 3;
static public var MIDDLE_DOWN:Number = 1 << 4;
static public var MIDDLE_UP:Number = 1 << 5;
static public var DOUBLE:Number = 1 << 6;
static public var SCROLL:Number = 1 << 7;
private var intervalID:Number;
private var mouseListener:Object;
// Button states (true = down, false = up)
private var LMB:Boolean;
private var RMB:Boolean;
private var MMB:Boolean;
// stored time between two clicks
private var LMBtime:Number;
private var MMBtime:Number;
private var RMBtime:Number;
// after some tests, the fastests I could click was 30 ms
public var time:Number = 30;
// offset between two mouseclicks to count as a doubleclick
public var doubletime:Number = 250;
// mixin methods from the EventDispatcher
public var addEventListener:Function;
public var removeEventListener:Function;
public var dispatchEvent:Function;
public var dispatchQueue:Function;
function MouseDetection() {
EventDispatcher.initialize(this);
LMB = RMB = MMB = false;
LMBtime = MMBtime = RMBtime = 0;
mouseListener = new Object();
mouseListener.onMouseWheel = Delegate.create(this, mousewheel);
Mouse.addListener(mouseListener);
startTesting();
}
public function startTesting() {
intervalID = setInterval(this, "enterframe", time);
}
public function stopTesting() {
clearInterval(intervalID);
}
// -- the rest are private methods, don't bother with them
private function enterframe() {
LMBsetter = Key.isDown(1);
RMBsetter = Key.isDown(2);
MMBsetter = Key.isDown(4);
// this commented bit of code doesn't seem to work all the time,
must be because of ALT
// Keycodes: 18 = ALT, 37 = LEFT, 39 = RIGHT
// backbutton = ALT+LEFT, forwardbutton = ALT+RIGHT
//if (Key.isDown(18) && Key.isDown(37)) trace("backbutton");
//if (Key.isDown(18) && Key.isDown(39)) trace("forwardbutton");
}
// -- LMB property setter, without getter (no need for it).
// This catches the true/false value, checks for double entries (!!!)
and dispatches the
// correct event before assigning the value to the LMB boolean, thus
saving a few lines.
function set LMBsetter(b:Boolean) {
if (b && !LMB) {
dispatchEvent({type:LEFT_DOWN, target:"LMB",
isDown:true});
} else if (!b && LMB) {
dispatchEvent({type:LEFT_UP, target:"LMB",
isDown:false});
// test doubleclick
var diff = getTimer()-LMBtime;
if (diff < doubletime) dispatchEvent({type:DOUBLE,
target:"LMB",
value:diff});
LMBtime = getTimer();
}
LMB = b;
}
function set MMBsetter(b:Boolean) {
if (b && !MMB) {
dispatchEvent({type:MIDDLE_DOWN, target:"MMB",
isDown:true});
} else if (!b && MMB) {
dispatchEvent({type:MIDDLE_UP, target:"MMB",
isDown:false});
// test doubleclick
var diff = getTimer()-MMBtime;
if (diff < doubletime) dispatchEvent({type:DOUBLE,
target:"MMB",
value:diff});
MMBtime = getTimer();
}
MMB = b;
}
function set RMBsetter(b:Boolean) {
if (b && !RMB) {
dispatchEvent({type:RIGHT_DOWN, target:"RMB",
isDown:true});
} else if (!b && RMB) {
dispatchEvent({type:RIGHT_UP, target:"RMB",
isDown:false});
// test doubleclick
var diff = getTimer()-RMBtime;
if (diff < doubletime) dispatchEvent({type:DOUBLE,
target:"RMB",
value:diff});
RMBtime = getTimer();
}
RMB = b;
}
private function mousewheel(direction:Number) {
if (direction > 0) dispatchEvent({type:SCROLL,
target:"scrollUp",
value:direction});
else dispatchEvent({type:SCROLL, target:"scrollDown",
value:direction});
}
}
2006/1/31, elibol <[EMAIL PROTECTED]>:
> All the Mouse events are summarized in the Mouse Class documentation. There
> isn't a right mouse click event.
>
> M.
>
> On 1/31/06, Charles Parcell <[EMAIL PROTECTED]> wrote:
> >
> > I am aware that you can alter the right mouse click context menu, but is
> > there a right mouse click event that can be used to activate other code??
> >
> > Charles P.
> >
> > _______________________________________________
> > Flashcoders mailing list
> > [email protected]
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> >
> >
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders