Set shiftKey of the MouseEvent object to true to simulate a Shift-click
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="addListeners()">
<mx:Script>
private function customLogEvent(e:MouseEvent):void {
ta1.text = e.currentTarget.id + ":" + e.type + ":" + e.shiftKey;
e.currentTarget.removeEventListener("doubleClick",customLogEvent);
}
private function handleEvent(e:MouseEvent):void {
e.currentTarget.addEventListener("doubleClick",customLogEvent);
var mev:MouseEvent = new MouseEvent("doubleClick");
mev.shiftKey = true;
e.currentTarget.dispatchEvent(mev);
}
private function addListeners():void {
b1.addEventListener("click",handleEvent);
b2.addEventListener("click",handleEvent);
}
</mx:Script>
<mx:VBox id="vb1">
<mx:Button id="b1" label="B1" />
<mx:Button id="b2" label="B2" />
<mx:TextArea id="ta1" />
</mx:VBox>
</mx:Application>
Related examples in the same category