[]鼠标穿透问题
List上面加了一层Sprite,Sprite有设置size大小,mouseThrough设为true,为何还能穿过Sprite滑动List?
代码如下:
代码如下:
package
{
import laya.display.Sprite;
import laya.display.Stage;
import laya.net.Loader;
import laya.ui.Image;
import laya.ui.List;
import laya.utils.Handler;
import laya.webgl.WebGL;
public class Bootstrapper extends Sprite
{
protected var _list:List;
protected var _items:Array;
protected var _loadingBg:Sprite;
public function Bootstrapper()
{
Laya.init(696, 1118, WebGL);
Laya.stage.bgColor = "#232628";
Laya.stage.scaleMode = Stage.SCALE_SHOWALL;
Laya.stage.screenMode = Stage.SCREEN_VERTICAL;
Laya.stage.alignH = Stage.ALIGN_CENTER;
Laya.stage.alignV = Stage.ALIGN_MIDDLE;
Laya.loader.load([{url:"image/comp.json", type:Loader.ATLAS}], Handler.create(this, onLoaded));
}
private function onLoaded():void
{
createList();
createItems();
createLoading();
_list.addChild(_loadingBg);
Laya.stage.addChild(_list);
}
protected function createList():void
{
_list = new List();
_list.itemRender = RecordItem;
_list.repeatX = 1;
_list.repeatY = 13;
_list.spaceY = 3;
_list.vScrollBarSkin = "";
_list.renderHandler = new Handler(this, renderHandler);
}
protected function createItems():void
{
_items = ;
for(var i:int = 0; i < 100; i++)
{
var image:Image = new Image("comp/clip_num.png");
image.size(240, 27);
_items.push(image);
}
_list.array = _items;
}
protected function renderHandler(cell:Sprite, index:int):void
{
removeAllChildren(cell);
cell.addChild(_items[index]);
}
protected function removeAllChildren(container:Sprite):void
{
while(container.numChildren > 0)
{
container.removeChildAt(0);
}
}
protected function createLoading():Sprite
{
_loadingBg = new Sprite();
_loadingBg.graphics.drawRect(0, 0, _list.width, _list.height, "#000000");
_loadingBg.alpha = .7;
_loadingBg.size(_list.width, _list.height);
_loadingBg.mouseThrough = true;
return _loadingBg;
}
}
}
import laya.display.Sprite;
class RecordItem extends Sprite
{
public function RecordItem()
{
super();
this.size(240, 27);
}
}
要回复问题请先登录
1 个回复
DemonWu
赞同来自: Charles