Show:

annieUI.ScrollList Class

Defined in: libs/ScrollList.js:11
Module: annieUI

Available since 1.0.9

有些时候需要大量的有规则的滚动内容。这个时候就应该用到这个类了

Methods

addChild

(
  • child
)
Void public

Inherited from annie.Sprite: libs/Sprite.js:101

Available since 1.0.0

添加一个显示对象到Sprite

Parameters:

Returns:

Void:

addChildAt

(
  • child
  • index
)
Void public

Inherited from annie.Sprite: libs/Sprite.js:191

Available since 1.0.0

添加一个child到Sprite中并指定添加到哪个层级

Parameters:

Returns:

Void:

addEventListener

(
  • type
  • listener
  • useCapture
)
Void public

Inherited from annie.EventDispatcher: libs/EventDispatcher.js:102

Available since 1.0.0

给对象添加一个侦听

Parameters:

  • type String

    侦听类型

  • listener Function

    侦听后的回调方法,如果这个方法是类实例的方法,为了this引用的正确性,请在方法参数后加上.bind(this);

  • useCapture Boolean

    true 捕获阶段 false 冒泡阶段 默认 true

Returns:

Void:

Example:

 this.addEventListener(annie.Event.ADD_TO_STAGE,function(e){console.log(this);}.bind(this));

addSound

(
  • sound
)
Void public

Inherited from annie.DisplayObject: libs/DisplayObject.js:816

Available since 2.0.0

返回一个id,这个id你要留着作为删除他时使用。 这个声音会根据这个显示对象添加到舞台时播放,移出舞台而关闭

Parameters:

Returns:

Void:

destroy

() Void public

Inherited from annie.AObject: libs/EventDispatcher.js:55

Available since 2.0.0

销毁一个对象 销毁之前一定要做完其他善后工作,否则有可能会出错

Returns:

Void:

dispatchEvent

(
  • event
  • data
  • useCapture
)
Boolean public

Inherited from annie.EventDispatcher: libs/EventDispatcher.js:149

Available since 1.0.0

广播侦听

Parameters:

  • event annie.Event | String

    广播所带的事件对象,如果传的是字符串则自动生成一个annie.Event对象,事件类型就是传入进来的字符串的值

  • data Object

    广播后跟着事件一起传过去的其他任信息,默认值为null

  • useCapture Boolean

    true 捕获阶段 false 冒泡阶段 默认 true

Returns:

Boolean:

如果有收听者则返回true

Example:

 var mySprite=new annie.Sprite(),
 yourEvent=new annie.Event("yourCustomerEvent");
 yourEvent.data={a:1,b:2,c:"hello",d:{aa:1,bb:2}};
 mySprite.addEventListener("yourCustomerEvent",function(e){
     console.log(e.data);
 })
 mySprite.dispatchEvent(yourEvent);

DisplayObject

() public

Inherited from annie.DisplayObject: libs/DisplayObject.js:70

Available since 1.0.0

getBounds

() annie.Rectangle public

Inherited from annie.DisplayObject: libs/DisplayObject.js:551

Available since 1.0.0

获取对象的自身的没有任何形变的原始姿态下的原点坐标及宽高,抽象方法

Returns:

getChildAt

(
  • index
)
annie.DisplayObject public

Inherited from annie.Sprite: libs/Sprite.js:251

Available since 1.0.0

获取Sprite中指定层级一个child

Parameters:

getChildByName

(
  • name
  • isOnlyOne
  • isRecursive
)
String | Array public

Inherited from annie.Sprite: libs/Sprite.js:155

Available since 1.0.0

通过给displayObject设置的名字来获取一个child,可以使用正则匹配查找

Parameters:

  • name String
    对象的具体名字或是一个正则表达式
  • isOnlyOne Boolean
    默认为true,如果为true,只返回最先找到的对象,如果为false则会找到所有匹配的对象数组
  • isRecursive Boolean
    false,如果为true,则会递归查找下去,而不只是查找当前对象中的child,child里的child也会找,依此类推

Returns:

String | Array: 返回一个对象,或者一个对象数组,没有找到则返回空

getChildIndex

(
  • child
)
Number public

Inherited from annie.Sprite: libs/Sprite.js:267

Available since 1.0.2

获取Sprite中一个child所在的层级索引,找到则返回索引数,未找到则返回-1

Parameters:

Returns:

getDrawRect

() annie.Rectangle public

Inherited from annie.DisplayObject: libs/DisplayObject.js:562

Available since 1.0.0

获取对象形变后外切矩形。 可以从这个方法中读取到此显示对象变形后x方向上的宽和y方向上的高

Returns:

getSound

(
  • id
)
Array

Inherited from annie.DisplayObject: libs/DisplayObject.js:791

Available since 2.0.0

Parameters:

Returns:

Array:

这个对象里所有叫这个名字的声音引用数组

getWH

() Width: number, height: number public

Inherited from annie.DisplayObject but overwritten in libs/Sprite.js:455

Available since 1.0.9

如果需要同时获取宽和高的值,建议使用此方法更有效率

Returns:

Width: number, height: number: }

globalToLocal

(
  • point
)
annie.Point public

Inherited from annie.DisplayObject: libs/DisplayObject.js:445

Available since 1.0.0

将全局坐标转换到本地坐标值

Parameters:

Returns:

hasEventListener

(
  • type
  • useCapture
)
Boolean public

Inherited from annie.EventDispatcher: libs/EventDispatcher.js:208

Available since 1.0.0

是否有添加过此类型的侦听

Parameters:

  • type String

    侦听类型

  • useCapture Boolean

    true 捕获阶段 false 冒泡阶段 默认 true

Returns:

Boolean:

如果有则返回true

hitTestPoint

(
  • hitPoint
  • isGlobalPoint
  • isMustMouseEnable
)
annie.DisplayObject public

Inherited from annie.DisplayObject: libs/DisplayObject.js:523

Available since 1.0.0

点击碰撞测试,就是舞台上的一个point是否在显示对象内,在则返回该对象,不在则返回null

Parameters:

  • hitPoint annie.Point

    要检测碰撞的点

  • isGlobalPoint Boolean

    是不是全局坐标的点,默认false是本地坐标

  • isMustMouseEnable Boolean

    是不是一定要MouseEnable为true的显示对象才接受点击测试,默认为不需要 false

localToGlobal

(
  • point
)
annie.Point public

Inherited from annie.DisplayObject: libs/DisplayObject.js:457

Available since 1.0.0

将本地坐标转换到全局坐标值

Parameters:

Returns:

removeAllChildren

() Void public

Inherited from annie.Sprite: libs/Sprite.js:345

Available since 1.0.0

移除Sprite上的所有child

Returns:

Void:

removeAllEventListener

() Void public

Inherited from annie.EventDispatcher: libs/EventDispatcher.js:261

Available since 1.0.0

移除对象中所有的侦听

Returns:

Void:

removeChild

(
  • child
)
Void public

Inherited from annie.Sprite: libs/Sprite.js:112

Available since 1.0.0

从Sprite中移除一个child

Parameters:

Returns:

Void:

removeChildAt

(
  • index
)
Void public

Inherited from annie.Sprite: libs/Sprite.js:320

Available since 1.0.0

移除指定层级上的孩子

Parameters:

Returns:

Void:

removeEventListener

(
  • type
  • listener
  • useCapture
)
Void public

Inherited from annie.EventDispatcher: libs/EventDispatcher.js:232

Available since 1.0.0

移除对应类型的侦听

Parameters:

  • type String

    要移除的侦听类型

  • listener Function

    侦听时绑定的回调方法

  • useCapture Boolean

    true 捕获阶段 false 冒泡阶段 默认 true

Returns:

Void:

removeSound

(
  • id
)
Void public

Inherited from annie.DisplayObject: libs/DisplayObject.js:833

Available since 2.0.0

删除一个已经添加进来的声音

Parameters:

Returns:

Void:

render

(
  • renderObj
)
Void public

Inherited from annie.DisplayObject: libs/DisplayObject.js:656

Available since 1.0.0

调用此方法将显示对象渲染到屏幕

Parameters:

  • renderObj annie.IRender

Returns:

Void:

ScrollList

(
  • itemClassName
  • itemWidth
  • itemHeight
  • vW
  • vH
  • isVertical
  • cols
)

Defined in libs/ScrollList.js:20

Available since 1.0.9

构造函数

Parameters:

  • itemClassName Class

    可以做为Item的类

  • itemWidth Number

    item宽

  • itemHeight Number

    item高

  • vW Number

    列表的宽

  • vH Number

    列表的高

  • isVertical Boolean

    是横向滚动还是纵向滚动 默认是纵向

  • cols Number

    分几列,默认是1列

ScrollPage

(
  • vW
  • vH
  • maxDistance
  • isVertical
)
构造函数

Parameters:

  • vW Number
    可视区域宽
  • vH Number
    可视区域高
  • maxDistance Number
    最大滚动的长度
  • isVertical Boolean
    是纵向还是横向,也就是说是滚x还是滚y,默认值为沿y方向滚动

Example:

 s.sPage=new annieUI.ScrollPage(640,s.stage.viewRect.height,4943);
     s.addChild(s.sPage);
     s.sPage.view.addChild(new home.Content());
     s.sPage.y=s.stage.viewRect.y;
     s.sPage.mouseEnable=false;

测试链接

scrollTo

(
  • dis
  • time
)
public

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:371

Available since 1.1.1

滚到指定的坐标位置

Parameters:

  • dis Number
    需要去到的位置
  • time Number
    滚动需要的时间 默认为0 即没有动画效果直接跳到指定页

setLoading

(
  • downLoading
)

Defined in libs/ScrollList.js:180

Available since 1.0.9

设置加载数据时显示的loading对象

Parameters:

setViewRect

(
  • w
  • h
  • isVertical
)
public

Inherited from annieUI.ScrollPage but overwritten in libs/ScrollList.js:132

Available since 1.1.1

设置可见区域,可见区域的坐标始终在本地坐标中0,0点位置

Parameters:

  • w Number

    设置可见区域的宽

  • h Number

    设置可见区域的高

  • isVertical Boolean

    方向

Sprite

() public

Inherited from annie.Sprite: libs/Sprite.js:23

Available since 1.0.0

构造函数

startDrag

(
  • isCenter
  • bounds
)
Void public

Inherited from annie.DisplayObject: libs/DisplayObject.js:477

Available since 1.1.2

启动鼠标或者触摸拖动

Parameters:

  • isCenter Boolean

    指定将可拖动的对象锁定到指针位置中心 (true),还是锁定到用户第一次单击该对象的位置 (false) 默认false

  • bounds annie.Rectangle

    相对于显示对象父级的坐标的值,用于指定 Sprite 约束矩形

Returns:

Void:

stopAllSounds

() Void public

Inherited from annie.DisplayObject: libs/DisplayObject.js:776

Available since 2.0.0

停止这个显示对象上的所有声音

Returns:

Void:

stopDrag

() Void public

Inherited from annie.DisplayObject: libs/DisplayObject.js:511

Available since 1.1.2

停止鼠标或者触摸拖动

Returns:

Void:

swapChild

(
  • child1
  • child2
)
Boolean

Inherited from annie.Sprite: libs/Sprite.js:285

Available since 2.0.0

交换两个显示对象的层级

Parameters:

  • child1 Object
    显示对象,或者显示对象的索引
  • child2 Object
    显示对象,或者显示对象的索引

Returns:

update

() Void public

Inherited from annie.DisplayObject: libs/DisplayObject.js:595

Available since 1.0.0

更新函数

Returns:

Void:

updateData

(
  • data
  • isReset
)

Defined in libs/ScrollList.js:65

Available since 1.0.9

更新列表数据

Parameters:

Properties

addSpeed

Number protected

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:134

Available since 1.0.0

加速度

alpha

Number public

Inherited from annie.DisplayObject: libs/DisplayObject.js:259

Available since 1.0.0

显示对象透明度

Default: 1

anchorX

Number public

Inherited from annie.DisplayObject: libs/DisplayObject.js:313

Available since 1.0.0

显示对象上x方向的缩放或旋转点

Default: 0

anchorY

Number public

Inherited from annie.DisplayObject: libs/DisplayObject.js:331

Available since 1.0.0

显示对象上y方向的缩放或旋转点

Default: 0

blendMode

String public

Inherited from annie.DisplayObject: libs/DisplayObject.js:372

Available since 1.0.0

显示对象的混合模式 支持的混合模式大概有

Default: 0

cacheAsBitmap

Boolean public

Inherited from annie.Sprite: libs/Sprite.js:70

Available since 1.1.2

小游戏不支持 小程序不支持

是否缓存为位图,注意一但缓存为位图,它的所有子级对象上的事件侦听都将无效

Default: false

children

Array public

Inherited from annie.Sprite: libs/Sprite.js:41

Available since 1.0.0

显示对象的child列表

Default: []

currentPos

Number

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:425

Available since 2.0.1

获取当前滑动的位置

filters

Array public

Inherited from annie.DisplayObject: libs/DisplayObject.js:427

Available since 1.0.0

小游戏不支持 小程序不支持

显示对象的滤镜数组

Default: null

fSpeed

Number public

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:160

Available since 1.0.0

摩擦力,值越大,减速越快

Default: 20

height

Unknown public

Inherited from annie.DisplayObject: libs/DisplayObject.js:721

Available since 1.0.3

获取或者设置显示对象在父级里的y方向的高,不到必要不要用此属性获取高 如果你要同时获取宽高,建议使用getWH()方法获取宽和高

instanceId

Number public

Inherited from annie.AObject: libs/EventDispatcher.js:23

Available since 1.0.0

每一个annie引擎对象都会有一个唯一的id码。

Example:

 //获取 annie引擎类对象唯一码
 console.log(this.instanceId);

instanceType

String public

Inherited from annie.AObject: libs/EventDispatcher.js:41

Available since 1.0.3

每一个annie类都有一个实例类型字符串,通过这个字符串,你能知道这个实例是从哪个类实例而来

isSpringBack

Boolean

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:174

Available since 2.0.1

是否有回弹效果,默认是true

isStop

Boolean public

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:142

Available since 1.0.0

是否是停止滚动状态

Default: true

isVertical

Boolean protected

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:62

Available since 1.0.0

横向还是纵向 默认为纵向

Default: true

loadingView

Unknown

Defined in libs/ScrollList.js:53

Available since 1.0.9

获取下拉滚动的loadingView对象

mask

annie.DisplayObject public

Inherited from annie.DisplayObject: libs/DisplayObject.js:398

Available since 1.0.0

显示对象的遮罩, 是一个Shape显示对象或是一个只包含shape显示对象的MovieClip

Default: null

matrix

annie.Matrix public

Inherited from annie.DisplayObject: libs/DisplayObject.js:382

Available since 1.0.0

显示对象的变形矩阵

Default: null

maxDistance

Number public

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:90

Available since 1.0.0

整个滚动的最大距离值

Default: 1040

maxSpeed

Number public

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:151

Available since 1.0.0

滚动的最大速度,直接影响一次滑动之后最长可以滚多远

Default: 100

minDis

Number protected
最小鼠标滑动距离

mouseChildren

Boolean public

Inherited from annie.Sprite: libs/Sprite.js:31

Available since 1.0.0

是否可以让children接收鼠标事件 鼠标事件将不会往下冒泡

Default: true

mouseEnable

Boolean public

Inherited from annie.DisplayObject: libs/DisplayObject.js:108

Available since 1.0.0

是否可以接受点击事件,如果设置为false,此显示对象将无法接收到点击事件

Default: false

name

String public

Inherited from annie.DisplayObject: libs/DisplayObject.js:119

Available since 1.0.0

每一个显示对象都可以给他命一个名字,这样我们在查找子级的时候就可以直接用this.getChildrndByName("name")获取到这个对象的引用

Default: ""

parent

annie.Sprite public

Inherited from annie.DisplayObject: libs/DisplayObject.js:94

Available since 1.0.0

显示对象的父级

Default: null

rotation

Number public

Inherited from annie.DisplayObject: libs/DisplayObject.js:241

Available since 1.0.0

显示对象旋转角度

Default: 0

scaleX

Number public

Inherited from annie.DisplayObject: libs/DisplayObject.js:205

Available since 1.0.0

显示对象x方向的缩放值

Default: 1

scaleY

Number public

Inherited from annie.DisplayObject: libs/DisplayObject.js:223

Available since 1.0.0

显示对象y方向的缩放值

Default: 1

skewX

Number public

Inherited from annie.DisplayObject: libs/DisplayObject.js:277

Available since 1.0.0

显示对象x方向的斜切值

Default: 0

skewY

Number public

Inherited from annie.DisplayObject: libs/DisplayObject.js:295

Available since 1.0.0

显示对象y方向的斜切值

Default: 0

soundList

Array public

Inherited from annie.DisplayObject: libs/DisplayObject.js:154

Available since 2.0.0

当前对象包含的声音列表

Default: []

speed

Number protected

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:126

Available since 1.0.0

速度

stage

Stage public

Inherited from annie.DisplayObject: libs/DisplayObject.js:84

Available since 1.0.0

此显示对象所在的舞台对象,如果此对象没有被添加到显示对象列表中,此对象为空。

Default: null;

view

annie.Sprite public

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:116

Available since 1.0.0

真正的容器对象,所有滚动的内容都应该是添加到这个容器中

viewHeight

Number protected

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:80

Available since 1.0.0

可见区域的高

Default: 0

viewWidth

Number protected

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:71

Available since 1.0.0

可见区域的宽

Default: 0

visible

Boolean public

Inherited from annie.DisplayObject: libs/DisplayObject.js:349

Available since 1.0.0

显未对象是否可见

Default: 0

width

Unknown public

Inherited from annie.DisplayObject: libs/DisplayObject.js:698

Available since 1.0.3

获取或者设置显示对象在父级里的x方向的宽,不到必要不要用此属性获取高 如果你要同时获取宽高,建议使用getWH()方法获取宽和高

x

Number public

Inherited from annie.DisplayObject: libs/DisplayObject.js:168

Available since 1.0.0

显示对象位置x

Default: 0

y

Number public

Inherited from annie.DisplayObject: libs/DisplayObject.js:186

Available since 1.0.0

显示对象位置y

Default: 0

滚动距离

Number protected

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:99

Available since 1.0.0

Default: 0

Events

ADD_TO_STAGE

Inherited from annie.DisplayObject: libs/DisplayObject.js:23

Available since 1.0.0

annie.DisplayObject显示对象加入到舞台事件

annie.Event.ON_SCROLL_START

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:51

Available since 1.1.0

annieUI.ScrollPage组件开始滑动事件

annie.Event.ON_SCROLL_STOP

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:46

Available since 1.1.0

annieUI.ScrollPage组件停止滑动事件

annie.Event.ON_SCROLL_TO_END

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:56

Available since 1.1.0

annieUI.ScrollPage组件滑动到结束位置事件

annie.Event.ON_SCROLL_TO_HEAD

Inherited from annieUI.ScrollPage: libs/ScrollPage.js:41

Available since 1.1.0

annieUI.ScrollPage组件滑动到开始位置事件

CLICK

String

annie.DisplayObject鼠标或者手指单击

ENTER_FRAME

Inherited from annie.DisplayObject: libs/DisplayObject.js:33

Available since 1.0.0

annie.DisplayObject显示对象 循环帧事件

MOUSE_DOWN

Inherited from annie.DisplayObject: libs/DisplayObject.js:39

Available since 1.0.0

annie.DisplayObject鼠标或者手指按下事件

MOUSE_MOVE

Inherited from annie.DisplayObject: libs/DisplayObject.js:54

Available since 1.0.0

annie.DisplayObject鼠标或者手指移动事件

MOUSE_OUT

Inherited from annie.DisplayObject: libs/DisplayObject.js:64

Available since 1.0.0

annie.DisplayObject鼠标或者手指移出显示对象边界触发的事件

MOUSE_OVER

Inherited from annie.DisplayObject: libs/DisplayObject.js:59

Available since 1.0.0

annie.DisplayObject鼠标或者手指移入到显示对象上里触发的事件

MOUSE_UP

Inherited from annie.DisplayObject: libs/DisplayObject.js:44

Available since 1.0.0

annie.DisplayObject鼠标或者手指抬起事件

REMOVE_TO_STAGE

Inherited from annie.DisplayObject: libs/DisplayObject.js:28

Available since 1.0.0

annie.DisplayObject显示对象从舞台移出事件