最近项目中遇到tilelist中拖拽的时scroll的移动速度太快,导致无法准确定位到某一行。Gosh!经过近4天终于找到解决方案。
1。首先override TileList的dragScroll方法,新的方法中将不做任何操作;
2。找到拖拽的dragProxy也即拖拽时展现的image,让其监听mouseMove方法,将stage.mouseY保存在成员变量中;
3。拖拽的时候启动一个定时器,设为每1秒钟执行一次,在执行方法中判断stage.mouseY,如果小于TileList的上边缘,滚动条上移一个单位,如果大于TileList的下边缘,滚动条下移一个单位。
部分代码如下:
300){
value = myTile.verticalScrollPosition + 1;
myTile.verticalScrollPosition = Math.min(myTile.maxVerticalScrollPosition,value);
}
}
private function proxyMoveHandler(event:MouseEvent):void {
trace(event.stageX+"x:----------------y:"+event.st ageY);
dragOjbY = event.stageY;
}
private function tileMouseDown(event:MouseEvent):void {
var target:ScrollThumb = event.target as ScrollThumb;
if(target){
trace("不进行拖拽---------滚动条-------");
canDrag = false;
return;
}
canDrag = true;
}
private function upHandler(event:MouseEvent):void {
if(dragTimer.running){
dragTimer.stop();
dragTimer.removeEventListener(TimerEvent.TIMER,dra gTimerHandler);
}
}
private function tileDragEnterHandler(event:DragEvent):void {
DragManager.acceptDragDrop(event.target as UIComponent);
}
]]>
width="100" height="100"/>
width="568" height="220"
columnWidth="110" rowHeight="110"
verticalScrollPolicy="on"
mouseMove="tileMouseMoveHandler(event)"
mouseDown="tileMouseDown(event)"
dragEnter="tileDragEnterHandler(event)"
dropEnabled="false"
allowMultipleSelection="true">
分享到:
相关推荐
主要使用TileList控件,实现相册的功能。包括相册的翻页,以及点选相册时,图片的特效放大浏览、切换等等功能。
这个例子展示了如何利用Flex的TileList控件,Image控件和PopUpManager类来创建一个简单的图片展示(相册)。
很好的解决了flex的tilelist中的checkbox 选中后,下拉滚动条乱选问题。同时解决了获取tilelist里面的数据问题。很不错的
TileList、Tree、VSlider VideoDisplay 7、容器控件(可包含控件及容器控件) Canvas、ControlBar、Form、FormHeading、Grid、HBox、HDividedBox ModuleLoader、Panel、Spacer、Tile、TileWindow、VBox、...
使用过TileList的朋友可能知道,该组件没有Item与Item之间的间距设置。而且theme也没有办法象linkbar那样设置样式corner-radius改变形状。
Flex问题解决大全, 可学到不少技巧, 仅限科学研究用.
总结cocos2d-x中滑动控件TileList的用法
flex3的cookbook书籍完整版dpf(包含目录),目录是我花了两个多小时自己整理的,希望对大家有帮助。 目录: 第一章.Flex与ActionScript基础(3) 1.1节.用FlexBuilder创建Flex项目 1.2节.用FlexBuilder创建Flex库项目 ...
a set of components with angularjs, which includes Datagrid,tree,dialog,progress,tilelist,tabset,dividedbox,imageview and so on. 参照了UI Bootstrap等组件的写法,主要对指令进行了自己的封装,我们希望...
WebUI4Angular是基于angularjs实现的一套UI组件,主要包括:datagrid,tree,dialog,progress,tilelist,tabset,dividedbox,imageview等等。组件需要使用angularjs1.3以上版本,其中拍照组件cameraScanner另需安装flash...
使用基于 List 的组件 . . . . . . . . . . . . . . . . . . . . . . . 24 使用 DataProvider . . . . . . . . . . . . . . . . . . . . . . . . 24 使用 CellRenderer . . . . . . . . . . . . . . . . . . . . . ....