flex 屏蔽右键

1,html:






























2,as:


mouseOver="getMouseTarget(event)" >

import mx.events.MenuEvent;
import mx.controls.Alert;

private var mouseTarget:DisplayObject;
public function init():void
{
ExternalInterface.addCallback("openRightClick_js", openRightClick);
}

public function getMouseTarget(event:MouseEvent):void
{
mouseTarget = DisplayObject(event.target);
}

public function openRightClick():void
{
var e:MouseEvent = new MouseEvent(MouseEvent.MOUSE_DOWN, true, false, mouseTarget.mouseX, mouseTarget.mouseY);
mouseTarget.dispatchEvent(e);
}
public function showMouseEvent(event:MouseEvent):void
{
if(event.buttonDown == true)
Alert.show("Left");
else
Alert.show("Right");
}


]]>


file:///F|/AGD/AGD/src/Resources/AICEmail_back.png


你可能感兴趣的:(flex,知识)