找不到类型或者它不是编译时常数:MouseEvent 我是照着书上打得啊 就是实现鼠标绘制任意线条 求助啊 好心人
package{importflash.display.Sprite;importflash.display.Shape;importflash.display.Mous...
package{
import flash.display.Sprite;
import flash.display.Shape;
import flash.display.MouseEvent;
public class line extends Sprite{
private var sp:Shape;
private var p:Boolean;
public function line(){
sp=new Shape();
addChild(sp);
stage.addEventListener(MouseEvent.MOUSE_DOWN,mousedown);
stage.addEventListener(MouseEvent.MOUSE_UP,mouseup);
stage.addEventListener(MouseEvent.MOUSE_MOVE,mousemove);}
private function mousedown(evt:Event):void{
sp.graphics.lineStyle(1,0xffff00,1);
sp.graphics.moveTo(mouseX,mouseY);
p=true;}
private function mousemove(evt:Event):void{
if(p)
{sp.graphics.lineTo(mouseX,mouseY);}
evt:updateAfterEvent();}
private function mouseup(evt:Event):void{
p=false;}
}
} 展开
import flash.display.Sprite;
import flash.display.Shape;
import flash.display.MouseEvent;
public class line extends Sprite{
private var sp:Shape;
private var p:Boolean;
public function line(){
sp=new Shape();
addChild(sp);
stage.addEventListener(MouseEvent.MOUSE_DOWN,mousedown);
stage.addEventListener(MouseEvent.MOUSE_UP,mouseup);
stage.addEventListener(MouseEvent.MOUSE_MOVE,mousemove);}
private function mousedown(evt:Event):void{
sp.graphics.lineStyle(1,0xffff00,1);
sp.graphics.moveTo(mouseX,mouseY);
p=true;}
private function mousemove(evt:Event):void{
if(p)
{sp.graphics.lineTo(mouseX,mouseY);}
evt:updateAfterEvent();}
private function mouseup(evt:Event):void{
p=false;}
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询