//脚本很简单,你新建一个AS3的flash文档,复制粘贴以下脚本就可以了。
import flash.events.MouseEvent;
import flash.events.KeyboardEvent;
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFieldType;
var mc:MovieClip = new MovieClip();
addChild(mc);
mc.graphics.beginFill(0xff0000);
mc.graphics.drawRect(0, 0, 100, 100);
mc.graphics.endFill();
addChild(mc);
mc.x = mc.y = 100;
var fast:int = 15;
stage.addEventListener(MouseEvent.MOUSE_WHEEL, doZoom);
stage.addEventListener(MouseEvent.MOUSE_DOWN, doDrag);
stage.addEventListener(MouseEvent.MOUSE_UP, doDrop);
stage.addEventListener(KeyboardEvent.KEY_DOWN, doSwitch);
function doZoom(evt:MouseEvent):void{
this.scaleX = this.scaleY += evt.delta/100;
}
function doDrag(evt:MouseEvent):void{
this.startDrag();
}
function doDrop(evt:MouseEvent):void{
this.stopDrag();
}
function doSwitch(evt:KeyboardEvent):void{
trace(evt.keyCode);
switch (evt.keyCode){
case 187:
this.scaleX = this.scaleY += 0.3;
this.x = this.y -= 80;
break;
case 189:
this.scaleX = this.scaleY -= 0.3;
this.x = this.y += 80;
break;
case Keyboard.LEFT:
this.x -= fast;
break;
case Keyboard.RIGHT:
this.x += fast;
break;
case Keyboard.UP:
this.y -= fast;
break;
case Keyboard.DOWN:
this.y += fast;
break;
default:
trace(evt.keyCode);
break;
}
}
/*担心你的flash软件有问题,帮你发布了一个exe的文件给你。至于flash cs5.5不能下载的问题,是因为下载的次数太多了,你保持到自己的中转站就能下载。都是些简单的问题。。。。
这些脚本供你参考,并没有侦听A到Z键,你只要简单修改就能用了。*/