Based on this link , this was a problem, but was fixed two years ago. Oddly enough, my tests show that it still does not work.
This class demonstrates that it will work correctly in js, but not in neko.
class Main extends Sprite
{
public function new()
{
super();
var s:Sprite = new Sprite();
s.graphics.beginFill(0xff0000);
s.graphics.drawCircle(100, 100, 200);
s.graphics.endFill();
addChild(s);
s.addEventListener(MouseEvent.CLICK, OnClick);
s.addEventListener(MouseEvent.MOUSE_WHEEL, OnWheel);
addEventListener(MouseEvent.CLICK, OnStageClick);
}
private function OnStageClick(e:MouseEvent):Void
{
trace(e.shiftKey);
}
private function OnWheel(e:MouseEvent):Void
{
trace(e.shiftKey);
}
private function OnClick(e:MouseEvent):Void
{
trace(e.shiftKey);
}
}
openfl.events.KeyboardEvent
, ( , 16). .
class Main extends Sprite
{
var shiftIsPressed:Bool = false;
public function new()
{
super();
stage.addEventListener(KeyboardEvent.KEY_DOWN, OnDown);
stage.addEventListener(KeyboardEvent.KEY_UP, OnUp);
stage.addEventListener(MouseEvent.CLICK, OnClick);
}
private function OnUp(e:KeyboardEvent):Void
{
if (e.keyCode == 16)
{
shiftIsPressed = false;
}
}
private function OnDown(e:KeyboardEvent):Void
{
if (e.keyCode == 16)
{
shiftIsPressed = true;
}
}
private function OnClick(e:MouseEvent):Void
{
if (shiftIsPressed)
{
trace('Click!');
}
}
}
, , , ++. , - , - .
2 (sept 22)
-