- 注册时间
- 2014-10-17
- 最后登录
- 2014-10-19
- 阅读权限
- 20
- 积分
- 17
- 精华
- 0
- 帖子
- 6
|
本帖最后由 banete 于 2014-10-19 19:38 编辑
大神,我觉得可能是由于我页面布局的缘故,一开始我是想在一个页面里面划出一个div来加载canvas来展示动画的,因此把页面划分成了三部分
<div id="header" style="width:250px;height:80px;margin-left:auto;margin-right:auto;margin-top:5%;"></div>
<div id="legend" style="width:800px;height:450px;margin-left:auto;margin-right:auto;margin-top:5%;"></div>
<div id="footer" style="width:250px;height:80px;margin-left:auto;margin-right:auto;margin-top:5%;" ></div>
<script>
LInit(50,"legend",800,450,main);
var layer,label,button01,button02;
function main(){
LGlobal.setDebug(true);
var backLayer = new LSprite();
backLayer.graphics.drawRect(1,"#000000",[0,0,LGlobal.width,LGlobal.height],true,"#cccccc");
addChild(backLayer);
layer = new LSprite();
layer.y = 100;
layer.graphics.drawRect(2,"#ff0000",[0,0,500,300],true,"#880088");
backLayer.addChild(layer);
button02=new LBitmap( new LBitmapData("#00ffff", 0, 0, 100, 100));
button02.x = 10;
button02.y = 10;
button01 = new LSprite();
button01.addChild(button02);
layer.addChild(button01);
label = new LTextField();
label.text = "layer01";
label.size = 20;
label.x = 400;
label.y = 10;
layer.addChild(label);
mouseevent();
}
function mouseevent(){
layer.addEventListener(LMouseEvent.MOUSE_DOWN,mousedownlayer);
layer.addEventListener(LMouseEvent.MOUSE_UP,mouseuplayer);
button01.addEventListener(LMouseEvent.MOUSE_DOWN,mousedownbutton01);
button01.addEventListener(LMouseEvent.MOUSE_UP,mouseupbutton01);
}
function mousedownlayer(e){
trace("layer01 is mousedown");
}
function mouseuplayer(e){
trace("layer01 is mouseup");
console.log(button01);
}
function mousedownbutton01(e){
trace("button01 is mousedown");
}
function mouseupbutton01(e){
trace("button01 is mouseup");
}
</script> |
|