实现单张图片时,会有点击缩放效果

Constructor

new ()

Variables

read onlylabel:ZLabel

sound:String

点击音效ID名

write onlyclickEvent:Void ‑> Void

Methods

getText ():String

setScale9Grid (rect:Rectangle):Void

设置九宫格格式

Parameters:

null

rect

setText (text:String):Void

setTextColor (color:UInt):Void

setTextPos (xz:Float, yz:Float):Void

setTextSize (size:Int):Void

Static variables

staticdefaultSound:String

默认音频

Static methods

@:value({ out : null, over : null, down : null })staticcreateButton (up:Dynamic, ?down:Dynamic, ?over:Dynamic, ?out:Dynamic):ZButton

快捷创建按钮

Parameters:

up
down
over
out

Returns:

ZButton

staticcreateModelButton (txt:String):ZButton

创建模态按钮(zygame框架中的按钮样式)

Parameters:

txt

Returns:

ZButton

@:value({ out : null, over : null, down : null })staticcreateSkin (up:Dynamic, ?down:Dynamic, ?over:Dynamic, ?out:Dynamic):ButtonSkin

快捷创建皮肤

Parameters:

up
down
over
out

Returns:

ButtonSkin

Inherited Variables

Defined by ToggleButton

box:ZBox

按钮容器

read onlytoggleState:String

Defined by Component

Defined by TouchDisplayObjectContainer

@:value(false)isTouch:Bool = false

@:value(true)mouseEvent:Bool = true

默认触摸为鼠标触摸

Defined by DisplayObjectContainer

@:keepbaseBuilder:Builder

基础生成baseBuilder,该属性只有通过MiniEngine创建时生效。

@:value(null)@:keepbindType:String = null

绑定类型,Maplive可用

@:keepcustomData:Dynamic

自定义数据,默认为null,可以作为扩展数据使用

@:keephAlign:String

横向对齐实现

@:value(false)@:keepisInit:Bool = false

@:keep@:noCompletionscrollMaskDislayObject:DisplayObject

Bate功能:遮罩对象(依赖scrollRect实现的遮罩逻辑实现)

@:value(0)@:keepsubtractionHeight:Int = 0

@:keeptween:ZTween

动画配置:这里设置的ZTween将仅影响当前容器的动画

@:keepvAlign:String

竖向对齐实现

Inherited Methods

Defined by ToggleButton

sendToggleState (state:String):Void

发送选择状态

 *  @param state - 通过ToggleButton的静态常量状态处理

setContent (data:Dynamic):Void

设置按钮上下文内容

Parameters:

null

data

Defined by Component

addComponent (child:Component, pname:String):Component

添加组件

Parameters:

child
  • 组件
pname
  • 名字,定义好后可通过findComponent方法查找

Returns:

Component

findComponent (pname:String):Component

查询组件

Parameters:

pname
  • 组件的名字

Returns:

Component

hasLayoutData ():Bool

是否存在布局文件

Returns:

Bool

onSkinChange (e:Event):Void

Defined by TouchDisplayObjectContainer

onMouseDown (e:MouseEvent):Void

onMouseMove (e:MouseEvent):Void

onMouseUp (e:MouseEvent):Void

onTouchMove (e:TouchEvent):Void

onTouchOut (e:MouseEvent):Void

onTouchOver (e:MouseEvent):Void

@:value({ priority : 0, userCapture : false })setTouchEvent (listen:Bool, userCapture:Bool = false, priority:Int = 0):Void

设置触摸事件

 *  @param listen - 是否侦听,false则清理所有事件

Defined by DisplayObjectContainer

@:value({ h : null, v : null })@:keepalignPivot (?v:String, ?h:String):Void

锚点对齐,不能直接对齐调用,容器不直接支持该功能。

@:keepdestroy ():Void

释放接口实现

@:keepgetAspectRatio ():Float

获取屏幕比例,>= 0.62的基本是平板尺寸

Returns:

Float

@:keepgetBounds (target:DisplayObject):Rectangle

getBounds优化计算

Parameters:

parent

Returns:

openfl.geom.Rectangle

@:keepgetStageHeight ():Float

经过了缩放计算的舞台高度

 *  @return Float

@:keepgetStageWidth ():Float

经过了缩放计算的舞台宽度

 *  @return Float

@:keepgetSubtractionHeight ():Int

获取高度削减高度

Returns:

Float

@:keepgetTopView ():DisplayObjectContainer

获取最顶层的容器

Returns:

DisplayObjectContainer

@:value({ f : "", e : "", d : "", c : "", b : "" })@:keeplog (a:Dynamic, b:Dynamic = "", c:Dynamic = "", d:Dynamic = "", e:Dynamic = "", f:Dynamic = ""):Void

输出log

@:keeponAddToStage ():Void

当添加到舞台时

@:keeponFrame ():Void

帧事件接口

@:keeponRemove ():Void

当自已被删掉时

@:keeponRemoveToStage ():Void

当从舞台移除时

@:keepscale (f:Float):DisplayObjectContainer

缩放处理

 *  @param f -
 *  @return DisplayObjectContainer

@:keepsetFrameEvent (listen:Bool):Void

设置帧事件使用

 *  @param listen - 是否侦听

@:keepsetSubtractionStageHeight (height:Int):Void

设置舞台高度削减

Parameters:

null

height