Packagecx.asQuery.starling
Classpublic final class ASQueryObject
InheritanceASQueryObject Inheritance Object

ASQuery主类



Public Methods
 MethodDefined By
  
ASQueryObject(root:DisplayObjectContainer, selector:*, onlyChild:Boolean = false)
ASQueryObject
  
all(fun:Function):ASQueryObject
对所有元素执行操作
ASQueryObject
  
添加子元素
ASQueryObject
  
添加到父元素
ASQueryObject
  
attr(name:*, value:* = null):ASQueryObject
设置属性
ASQueryObject
  
bind(type:String, handler:Function):ASQueryObject
绑定事件监听
ASQueryObject
  
click(handler:Function):ASQueryObject
点击事件 (兼容按钮和普通显示对象)
ASQueryObject
  
dispose():void
清理所有资源,并释放 注意:贴图和bitmapData不会自动释放,如果释放操作写在显示对象的dispose方法里面则会调用 此方法无返回
ASQueryObject
  
移除所有子对象 ,但不释放他们的资源占用
ASQueryObject
  
find(selector:*, onlyChild:Boolean = false):ASQueryObject
通过新的选择器查找内部元素
ASQueryObject
  
fun(name:String, params:Array = null):ASQueryObject
调用函数
ASQueryObject
  
get(index:int = 0):DisplayObject
获取内部元素
ASQueryObject
  
getAttr(name:String):*
获取属性
ASQueryObject
  
getContainer(index:int = 0):DisplayObjectContainer
获取内部容器
ASQueryObject
  
length():int
获得内部元素个数 如果为0,表示没有获取到元素
ASQueryObject
  
ready(fun:Function):void
初始化方法 确保在舞台上或添加到舞台时触发一次 一般在显示对象构造函数中调用:$(this).ready(init)
ASQueryObject
  
移除自己
ASQueryObject
  
设置深度到底层
ASQueryObject
  
设置深度到顶层
ASQueryObject
  
toggle(name:String = null):ASQueryObject
切换Boolean类型的属性状态
ASQueryObject
  
toString():String
输出字符串
ASQueryObject
  
touch(handler:Function):ASQueryObject
绑定touch事件
ASQueryObject
  
touchBegin(handler:Function):ASQueryObject
绑定Touch Begin事件
ASQueryObject
  
touchEnd(handler:Function):ASQueryObject
绑定Touch End事件
ASQueryObject
  
touchHover(handler:Function):ASQueryObject
绑定Touch Hover事件
ASQueryObject
  
touchMove(handler:Function):ASQueryObject
绑定Touch Move事件
ASQueryObject
  
trigger(event:Event):ASQueryObject
触发事件
ASQueryObject
  
unbind(type:String = null, handler:Function = null):ASQueryObject
解除事件监听 释放时可以不用显示调用此语句,因为Starling的dispose方法会清除所有子对象的监听。
ASQueryObject
Constructor Detail
ASQueryObject()Constructor
public function ASQueryObject(root:DisplayObjectContainer, selector:*, onlyChild:Boolean = false)

Parameters
root:DisplayObjectContainer — 主容器
 
selector:* — 选择器
 
onlyChild:Boolean (default = false) — 是否只遍历主容器的第一层子对象(否则遍历所有层级的子集)
Method Detail
all()method
public function all(fun:Function):ASQueryObject

对所有元素执行操作

Parameters

fun:Function

Returns
ASQueryObject
append()method 
public function append(child:*):ASQueryObject

添加子元素

Parameters

child:*

Returns
ASQueryObject
appendTo()method 
public function appendTo(parent:*):ASQueryObject

添加到父元素

Parameters

parent:*

Returns
ASQueryObject
attr()method 
public function attr(name:*, value:* = null):ASQueryObject

设置属性

Parameters

name:* — 属性名,如果有多个用{"x":10,"y":20}
 
value:* (default = null) — 单属性要设置的值(支持"+=10","-=10","10","/=10"几个运算符操作)

Returns
ASQueryObject
bind()method 
public function bind(type:String, handler:Function):ASQueryObject

绑定事件监听

Parameters

type:String — 事件类型
 
handler:Function — 监听函数

Returns
ASQueryObject
click()method 
public function click(handler:Function):ASQueryObject

点击事件 (兼容按钮和普通显示对象)

Parameters

handler:Function

Returns
ASQueryObject
dispose()method 
public function dispose():void

清理所有资源,并释放 注意:贴图和bitmapData不会自动释放,如果释放操作写在显示对象的dispose方法里面则会调用 此方法无返回

empty()method 
public function empty():ASQueryObject

移除所有子对象 ,但不释放他们的资源占用

Returns
ASQueryObject
find()method 
public function find(selector:*, onlyChild:Boolean = false):ASQueryObject

通过新的选择器查找内部元素

Parameters

selector:* — 选择器
 
onlyChild:Boolean (default = false) — 是否只遍历第一层子对象(否则遍历所有层级的子集)

Returns
ASQueryObject
fun()method 
public function fun(name:String, params:Array = null):ASQueryObject

调用函数

Parameters

name:String — 函数名
 
params:Array (default = null) — 参数数组

Returns
ASQueryObject
get()method 
public function get(index:int = 0):DisplayObject

获取内部元素

Parameters

index:int (default = 0) — 匹配的第几个

Returns
DisplayObject
getAttr()method 
public function getAttr(name:String):*

获取属性

Parameters

name:String

Returns
*
getContainer()method 
public function getContainer(index:int = 0):DisplayObjectContainer

获取内部容器

Parameters

index:int (default = 0) — 匹配的第几个

Returns
DisplayObjectContainer
length()method 
public function length():int

获得内部元素个数 如果为0,表示没有获取到元素

Returns
int
ready()method 
public function ready(fun:Function):void

初始化方法 确保在舞台上或添加到舞台时触发一次 一般在显示对象构造函数中调用:$(this).ready(init)

Parameters

fun:Function — 初始化回调函数 此方法无返回

remove()method 
public function remove():ASQueryObject

移除自己

Returns
ASQueryObject
setIndexBottom()method 
public function setIndexBottom():ASQueryObject

设置深度到底层

Returns
ASQueryObject
setIndexTop()method 
public function setIndexTop():ASQueryObject

设置深度到顶层

Returns
ASQueryObject
toggle()method 
public function toggle(name:String = null):ASQueryObject

切换Boolean类型的属性状态

Parameters

name:String (default = null) — 要切换的属性名,如果不传默认visible属性

Returns
ASQueryObject
toString()method 
public function toString():String

输出字符串

Returns
String
touch()method 
public function touch(handler:Function):ASQueryObject

绑定touch事件

Parameters

handler:Function

Returns
ASQueryObject
touchBegin()method 
public function touchBegin(handler:Function):ASQueryObject

绑定Touch Begin事件

Parameters

handler:Function

Returns
ASQueryObject
touchEnd()method 
public function touchEnd(handler:Function):ASQueryObject

绑定Touch End事件

Parameters

handler:Function

Returns
ASQueryObject
touchHover()method 
public function touchHover(handler:Function):ASQueryObject

绑定Touch Hover事件

Parameters

handler:Function

Returns
ASQueryObject
touchMove()method 
public function touchMove(handler:Function):ASQueryObject

绑定Touch Move事件

Parameters

handler:Function

Returns
ASQueryObject
trigger()method 
public function trigger(event:Event):ASQueryObject

触发事件

Parameters

event:Event — 要触发的事件

Returns
ASQueryObject
unbind()method 
public function unbind(type:String = null, handler:Function = null):ASQueryObject

解除事件监听 释放时可以不用显示调用此语句,因为Starling的dispose方法会清除所有子对象的监听。

Parameters

type:String (default = null) — 类型,如果不传,删除所有事件监听
 
handler:Function (default = null) — 函数,如果不传,删除所有本类型监听函数

Returns
ASQueryObject