samplemouseandkey.as
来自「《Flash AS3殿堂之路》光盘源码 学习ActionScript 3.0」· AS 代码 · 共 25 行
AS
25 行
package org.kingda.book.display
{
import flash.display.Sprite;
import flash.events.MouseEvent;
public class SampleMouseAndKey extends Sprite
{
public function SampleMouseAndKey() {
this.stage.addEventListener(MouseEvent.CLICK, clickHandler);
}
private function clickHandler(evt:MouseEvent):void {
var color:uint = 0xffffff;
if (evt.ctrlKey) color = 0x66cc00;
if (evt.altKey) color = 0x669933;
if (evt.shiftKey) color = 0x66ff00;
if (evt.altKey && evt.ctrlKey) color = 0xffcc00;
if (evt.altKey && evt.shiftKey) color = 0xffff00;
if (evt.altKey && evt.ctrlKey && evt.shiftKey) color = 0xff9900;
trace ("click:" + color.toString(16));
var star:StarShape = new StarShape(evt.stageX, evt.stageY, 5, 10, 20, 0, color);
addChild(star);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?