[]Uncaught TypeError: Cannot read property 'XXX' of undefined
private var spe:Sprite;
private function showApe():void {
spe = new Sprite();
spe.mouseEnabled = true;
spe.x = 100;
spe.y = 100;
spe.width = 512;
spe.height = 512;
spe.size(512, 512);
Laya.stage.addChild(spe);
spe.graphics.drawRect(0, 0, 515, 515, "#996633", "#333333");
spe.on(Event.MOUSE_DOWN, spe, onMouseDown);
Laya.stage.on(Event.MOUSE_UP, this, onMouseUp);
Laya.stage.on(Event.MOUSE_OUT, this, onMouseUp);
}
private function onMouseDown(e:Event):void {
spe.startDrag(new Rectangle(0,0,800,800));
}
鼠标点击Sprite报错:
Uncaught TypeError: Cannot read property 'startDrag' of undefined
private function showApe():void {
spe = new Sprite();
spe.mouseEnabled = true;
spe.x = 100;
spe.y = 100;
spe.width = 512;
spe.height = 512;
spe.size(512, 512);
Laya.stage.addChild(spe);
spe.graphics.drawRect(0, 0, 515, 515, "#996633", "#333333");
spe.on(Event.MOUSE_DOWN, spe, onMouseDown);
Laya.stage.on(Event.MOUSE_UP, this, onMouseUp);
Laya.stage.on(Event.MOUSE_OUT, this, onMouseUp);
}
private function onMouseDown(e:Event):void {
spe.startDrag(new Rectangle(0,0,800,800));
}
鼠标点击Sprite报错:
Uncaught TypeError: Cannot read property 'startDrag' of undefined
要回复问题请先登录
1 个回复
cuixueying
赞同来自: