看代码的时候思考一下,我一开始跟你说了是 大致原理,下面的才是实现你想要的效果的解决方案
private var _itemHeight:Number;
private var _oldY:Number;
private function onMuseHandler(type:Event,index:int):void
{
trace("type:" + type.type + "ddd--" + _list.scrollBar.value + "---index:" + index);
var curX:Number,curY:Number;
if(type.type== "mousedown")
{
_oldY = Laya.stage.mouseY;
var itemBox:Box = _list.getCell(index);
_itemHeight = itemBox.height;
}else if(type.type == "mouseout")
{
curY = Laya.stage.mouseY;
var chazhiY:Number = Math.abs(curY - _oldY);
var tempIndex:int = Math.ceil(chazhiY/_itemHeight);
trace("----------tempIndex:" + tempIndex + "---_itemHeight:" + _itemHeight + "---chazhiY:" + chazhiY);
var newIndex:int;
if(curY > _oldY)
{
//向下
newIndex = index + tempIndex;
_list.tweenTo(newIndex);
}else
{
//向上
newIndex = index - tempIndex;
_list.tweenTo(newIndex);
}
}
}