[]鼠标事件能否在有图形的区域感应,特别是子项坐标为负数时(已经找到问题)

package
{
import laya.display.Sprite;
import laya.events.Event;

public class MainUi extends Sprite
{

private var testPan:Sprite;
public function MainUi()
{
super();

this.graphics.drawRect(0,0,500,500,"#fff0cc");

testPan = new Sprite();
testPan.name = "testPan";
this.addChild( testPan );
testPan.pos( 300,300);
testPan.graphics.drawRect(0,0,90,100,"#faaff0");
testPan.on(Event.CLICK,this,onMouseClick);
testPan.width = 90;
testPan.height = 100;

var mcSp:Sprite = new Sprite();
mcSp.graphics.drawRect(0,0,90,100,"#fff000");
testPan.addChild( mcSp);
mcSp.pos( -25,-90 );
}

private function onMouseClick(e:Event):void
{
trace( e.target );
}
}
}

QQ截图20161124001114.png



点击b区域是有反应的,a区域是没有反应的,如果给它加一个指定区域
    testPan.hitArea = mcSp;
            mcSp.width = 90;
            mcSp.height = 100;
那他什么 都 响应不了

应该还要给 设置下   mcSp.mouseEnabled=true;

 
已邀请:

cuixueying

赞同来自:

好的,有问题随时反馈!

要回复问题请先

商务合作
商务合作