import flash.display.Shape;
import flash.events.MouseEvent;
/*所有矢量图位图一起动起来!*/
var shp:Shape = new Shape ()
shp= getChildAt(0) as Shape
//按钮的命名为:btn0,btn1
btn0.addEventListener(MouseEvent.CLICK,moveLift)
btn1.addEventListener(MouseEvent.CLICK,moveRight)
function moveLift(e:MouseEvent ):void {
shp.x-=10
}
function moveRight(e:MouseEvent ):void {
shp.x+=10
}
import flash.events.MouseEvent;
/*----------------单个的可以转为元件然后命名--mc为例---------------*/
btn0.addEventListener(MouseEvent.CLICK,moveLift)
btn1.addEventListener(MouseEvent.CLICK,moveRight)
function moveLift(e:MouseEvent ):void {
mc.x-=10
}
function moveRight(e:MouseEvent ):void {
mc.x+=10
}
是不是很简单呀