UI. Panel

Panel Is a panel container class.

Constructor

new Panel()

Create a new one Panel Class instance.

stay Panel The properties width and height are set to 100 in the constructor.

Extends

Member

alpha :Number

The transparency value is 0-1 and the default value is 1, which means opacity. Changing the alpha value affects drawcall.
Inherited From:

anchorX :Number

X axis anchor. The value is 0-1
Inherited From:

anchorY :Number

Y axis anchor. The value is 0-1
Inherited From:

autoSize :Boolean

Specifies whether to compute wide and high data automatically. The default value is false.

Sprite is wide and high, defaults to 0, and does not change with the rendering content. If you want to get the width of the drawing content, you can set the property as true or get it by the getBounds method. Set to true, has some impact on performance.

Inherited From:

blendMode :String

Specifies the blending mode to use. Currently only support "lighter"".
Inherited From:

bottom :Number

The vertical distance (in pixels) from the bottom edge of the component to the base edge of its content area.

Inherited From:

cacheAs :String

Overrides:

cacheAsBitmap :Boolean

Specifies whether the display object is cached as a static image. Functions with cacheAs's normal mode. It is recommended to use cacheAs instead.
Inherited From:

centerX :Number

In the parent container, the horizontal axis of the object is at a distance from the parent's container's horizontal central line (in pixels).

Inherited From:

centerY :Number

In the parent container, the vertical axis of the object is at a distance from the vertical centerline of the parent container (in pixels).

Inherited From:

comXml :Object

XML data.
Inherited From:

content :Sprite

Gets the content container object.

customRenderEnable :Boolean

Inherited From:

dataSource :Object

Inherited From:

destroyed :Boolean

[只读] Has it been destroyed?. Object cannot be used after destruction.
Inherited From:

disabled :Boolean

Disable page, set to true, grayed out, and disabled mouse.
Inherited From:

displayedInStage :Boolean

Indicates whether it is displayed in the display list.
Inherited From:

displayHeight :Number

The display height of the object (in pixels).

Inherited From:

displayWidth :Number

The display width of the object (in pixels).

Inherited From:

filters :Array

Filter set. You can set multiple filter combinations.
Inherited From:

globalScaleX :Number

Gets the global X axis scaling relative to stage (which adds the scaling value of the father node).
Inherited From:

globalScaleY :Number

Gets the global Y axis scaling relative to stage (which adds the scaling value of the father node).
Inherited From:

graphics :Graphics

Drawing object. Encapsulates the interface to draw bitmaps and vector diagrams, and all Sprite drawing operations are implemented through Graphics.
Inherited From:

gray :Boolean

Is it grayed out?.
Inherited From:

height :Number

Overrides:

hitArea :Object

You can set a Rectangle area as the click area, or set one HitArea As a click area, you can set clickable and clickable areas within HitArea.

If hitArea is not set, collisions are made according to the region formed by the width and height.

Inherited From:

hitTestPrior :Boolean

Specifies whether mouse event detection preferentially detects itself or preferentially detects its child object. The mouse event detection occurs at the capture phase of the mouse event. At this stage, the engine will begin to recursively check stage and its child objects from stage until the target object is hit or missed.

If false, the child object is preferentially detected, and when a child object is hit, interrupt detection is done to hit the target. If you do not hit any sub object, then the object detection; if true, then the priority detection object, if the object is not directly hit, interrupt detection, said did not hit the target; if the object is hit, further iterative detection of its children, in order to confirm the final target.

Reasonable use of this property, can reduce the mouse event detection nodes, improve performance. Can be set to true: the developer does not care about the mouse event detection result of the child node of the node, which is the mouse event detection point of the node as its child node.

The View component of the Stage object and UI defaults to true.

Inherited From:
Default Value:
  • false优先检测此对象的子对象,当递归检测完所有子对象后,仍然没有找到目标对象,最后再检测此对象。

hScrollBar :ScrollBar

Horizontal scroll bar object.

hScrollBarSkin :String

Horizontal scrollbar skin.

layoutEnabled :Boolean

Do you want to enable relative layout?
Inherited From:

left :Number

The horizontal distance (in pixels) from the left of the component to the left of its content area.

Inherited From:

mask :Sprite

Mask, you can set an object (support bitmap and vector diagram), according to the object shape for mask display.

[note] the mask object coordinate system is relative to the mask object itself, and is different from the Flash mechanism

Inherited From:

measureHeight :Number

Displays the actual display area height (in pixels) of the object.

Inherited From:

measureWidth :Number

Display the width of the actual display area of the object (in pixels).

Inherited From:

mouseEnabled :Boolean

Do you accept mouse events?. The default is false. If you listen to the mouse event, you will automatically set the property of the object and the parent node. The value of mouseEnable is true (if the parent node is manually set to false, it will not change). *
Inherited From:

mouseThrough :Boolean

Is the mouse event collision detected with this object?. Collision detection occurs at the capture phase of the mouse event. At this stage, the engine will start testing stage and its child objects recursively from stage until it finds the hit target object or misses any object.

The penetration indicates that the location of the mouse event is hit when it is in the drawing area of the object, and is independent of the object's width, height, and the hitArea attribute of the Rectangle object. If the sprite.hitArea value is a HitArea object, the mouse event response area of the object is declared explicitly, and the width, height, and mouseThrough attributes of the object are ignored.

The properties that affect the target mouse event response area are: width, height, hitArea, and the priority sequence is: hitArea (type:HitArea), >hitArea (type:Rectangle), >width/height.

Inherited From:
Default Value:
  • false不可穿透,此对象的鼠标响应区域由width、height、hitArea属性决定。

mouseX :Number

Returns the X axis coordinate information of the mouse in this object coordinate system.
Inherited From:

mouseY :Number

Returns the Y axis coordinate information of the mouse in this object coordinate system.
Inherited From:

name :String

Node name.
Inherited From:
Default Value:
  • ""

numChildren :int

Number of child objects.
Overrides:

optimizeScrollRect :Boolean

Specifies whether or not the display object that uses scrollRect is optimized. The default is false (not optimized).

When ture: this object uses the scrollRect set display contents without rendering display outside the region, to improve performance (if the sub object rotation or zoom center offset, display screening are not accurate).

Inherited From:

parent :Node

Parent node.
Inherited From:

pivotX :Number

The position of the center of the axis of the X axis, in pixels, and defaults to 0. The center of the axis affects the position of the object, the center of the scale, the center of rotation.
Inherited From:

pivotY :Number

The position of the center of the axis of the Y axis, in pixels, and defaults to 0. The center of the axis affects the position of the object, the center of the scale, the center of rotation.
Inherited From:

The horizontal distance (in pixels) from the right side of the component to the right of its content area.

Inherited From:

rotation :Number

The rotation angle defaults to 0. In angle.
Inherited From:

scaleX :Number

Inherited From:

scaleY :Number

Inherited From:

scrollRect :Rectangle

Display a rectangular rolling range object, has the effect of cutting (if you only want to limit the object rendering area, please use viewport), set optimizeScrollRect=true, can optimize the trimmed area content rendering.

The difference between srollRect and viewport: 1.srollRect comes with clipping effects, viewport only affects whether child objects render, and does not have clipping effects (higher performance).
*

Inherited From:

skewX :Number

The horizontal tilt angle defaults to 0. In angle.
Inherited From:

skewY :Number

Vertical tilt angle, defaults to 0. In angle.
Inherited From:

stage :Stage

On the stage stage References.
Inherited From:

staticCache :Boolean

When cacheAs is not null, this value is valid. When staticCache=true is changed, the child object does not automatically update the cache, and can only be manually refreshed by calling the reCache method.
Inherited From:

tag :Object

Object tag.

Inherited From:

texture :Texture

Set a Texture instance and display this image (if it has been previously drawn, it will be removed). Equivalent to graphics.clear (); graphics.drawImage ()
Inherited From:

timer :Timer

The time controller defaults to global Laya.timer. You can also separate instances of a Timer to control time scaling
Inherited From:

toolTip :Object

Hover hint.

Can be assigned to text String Or function Handler For custom style mouse prompts and parameter portability, etc..

Inherited From:
示例
Private, VaR, _testTips:TestTipsUI = new, TestTipsUI (); 
Private, function, testTips (): void { 
		  // Simple mouse prompt 
Btn2.toolTip = "here is the mouse prompt < b> bold < /b> < br> line feed.""; 
		  // Custom mouse prompt 
Btn1.toolTip = showTips1; 
		  // Custom mouse prompt with parameters 
Clip.toolTip = new, Handler (this, showTips2), ["clip"] ); 
} 
Private, function, showTips1 (): void { 
_testTips.label.text = "here is the button." [" + btn1.label + "] "; 
Tip.addChild (_testTips); 
} 
Private function showTips2 (name:String): void { 
_testTips.label.text = "here is + name"; 
Tip.addChild (_testTips); 
} 

top :Number

The vertical distance (in pixels) from the top edge of the component to its top edge of the content area.

Inherited From:

transform :Matrix

Object matrix information. By setting the matrix, you can achieve node rotation, zoom, displacement effect.

Matrix for more information, please refer to Matrix

Inherited From:

viewport :Rectangle

Outside the viewport viewport size, sub objects will not be rendered (if you want to achieve the effect of cutting, please use srollRect), reasonable use can improve the rendering performance. For example, a map block made up of small pictures will not render the small picture outside viewport

The difference between srollRect and viewport: 1. srollRect comes with clipping effects, and viewport only affects render of child objects, rendering without clipping (higher performance).
*

Inherited From:
Default Value:
  • null

visible :Boolean

Indicates whether it is visible and defaults to true. If the setting is not visible, the node will not be rendered.
Inherited From:

vScrollBar :ScrollBar

Vertical scroll bar object.

vScrollBarSkin :String

Vertical scroll bar skin.

width :Number

Overrides:

x :Number

Represents the horizontal coordinate value of the display object relative to the parent container.
Inherited From:

y :Number

Represents the vertical coordinate value of the display object relative to the parent container.
Inherited From:

zOrder :Number

Z sorting, changing this value, will reorder all objects in the same container according to the size of the value. The bigger the value, the closer it gets up. The default is 0, and sorted according to the addition order.
Inherited From:

Methods

_setParent()

Inherited From:

addChild(node) → {Node}

Adding child nodes.
Overrides:
Parameters:
Name Type Description
node Node Node object
Returns:
Type:
Node
Returns the node added

addChildAt(node, index) → {Node}

Adds a child node to the specified index location.
Overrides:
Parameters:
Name Type Description
node Node Node object.
index int Index location.
Returns:
Type:
Node
Returns the node added.

addChildren()

Adding child nodes in batches
Inherited From:
Parameters:
Name Type Attributes Description
...args Rest <repeatable>
Innumerable child nodes.

callLater(method, argsopt)

The specified function is delayed.

Called before the control is displayed on the screen, which is generally used to delay the calculation of data.

Inherited From:
See:
  • Panel.html#runCallLater()">#runCallLater()
Parameters:
Name Type Attributes Default Description
method function The name of the function to perform. For example, functionName.
args Array <optional>
null args Pass to method List of optional arguments for a function.

changeSize()

Readjust the size of the object.

Overrides:

clearTimer(caller, method)

Clean timer. Function same as Laya.timer.clearTimer ().
Inherited From:
Parameters:
Name Type Description
caller Object Execute domain (this).
method function Callback method at the end.

commitMeasure()

Immediately execute the call function that affects the wide height of the delay.

Inherited From:
See:
  • Panel.html#callLater()">#callLater()
  • Panel.html#runCallLater()">#runCallLater()

contains(node) → {Boolean}

Does the current container contain the specified? Node Node object.
Inherited From:
Parameters:
Name Type Description
node Node Designated Node Node object.
Returns:
Type:
Boolean
A Boolean value indicating whether the specified Node node object is included.

createChildren()

Creates and adds a control child node.

Overrides:

customRender(context, x, y)

Custom update, render display objects. It is generally used to extend the rendering mode. Please use it properly. This may cause rendering on the accelerator.

Be careful Do not add or delete tree nodes in this function, otherwise it will affect the traversal of tree nodes.

Inherited From:
Parameters:
Name Type Description
context RenderContext Rendering context references.
x Number X axis coordinate.
y Number Y axis coordinate.

destroy(destroyChild)

Destroy this object. The destroy object defaults to removing itself from the parent node and cleaning its reference relationship and waiting for the JS automatic garbage recovery mechanism to be recycled. No more can be used after destroy.

Destroy removes its own event listening, its own timer listening, removing the child object and removing itself from the parent node.

Overrides:
Parameters:
Name Type Description
destroyChild Boolean (optional) destroy the child node at the same time. If the value is true, the child node is destroyed, otherwise the child node is not destroyed.

destroyChildren()

Destroy all child objects without destroying themselves.
Overrides:

drawToCanvas(canvasWidth, canvasHeight, x, y) → {HTMLCanvas}

Draw current Sprite reach Canvas Go ahead and return a HtmlCanvas.

The result of the drawing can be used as a picture source to be drawn into another Sprite:

var htmlCanvas:HTMLCanvas = sprite.drawToCanvas(100, 100, 0, 0);// Draw sprites to canvas var texture:Texture = new Texture(htmlCanvas);// Using htmlCanvas to create Texture var sp:Sprite = new Sprite().pos(0, 200);// Create sprite and bring it down to the 200 position sp.graphics.drawImage(texture);// Draw screenshots to sprites Laya.stage.addChild(sp);// Show the sprite to the stage

You can also get the original picture data and share it on the Internet, so as to achieve the screenshot effect:

var htmlCanvas:HTMLCanvas = sprite.drawToCanvas(100, 100, 0, 0);// Draw sprites to canvas var canvas:* = htmlCanvas.getCanvas();// Gets the native canvas object trace(canvas.toDataURL("image/png"));// Print picture Base64 information, which can be sent to the server or saved as pictures
Inherited From:
Parameters:
Name Type Description
canvasWidth Number Canvas width.
canvasHeight Number Canvas height.
x Number Plotted X axis offset.
y Number Plotted Y axis offset.
Returns:
Type:
HTMLCanvas
HTMLCanvas object.

event(type, dataopt) → {Boolean}

Dispatch events.
Inherited From:
Parameters:
Name Type Attributes Default Description
type String Event type.
data Object <optional>
null data (optional) callback data. Be careful: If you need to pass multiple parameters, P1, P2, P3, you can use the array structure, such as: [p1,p2,p3,...] If you need to call a single parameter P, and P is an array, you need to use a structure such as: [p] Other single parameters, P, can be passed directly to the parameter P.
Returns:
Type:
Boolean
Is there a listener for this event type? If there is a listener, the value is true, otherwise the value is false.

frameLoop(delay, caller, method, argsopt, coverBefore)

Executes a function repeatedly (based on frame rate). Function same as Laya.timer.frameLoop ().
Inherited From:
Parameters:
Name Type Attributes Default Description
delay int How many frames (frames per frame) are spaced?.
caller Object Execute domain (this).
method function Callback method at the end.
args Array <optional>
null args Optional callback parameters.
coverBefore Boolean (optional) whether the delay is covered before default is true.

frameOnce(delay, caller, method, argsopt, coverBefore)

Perform a function at a certain time (based on frame rate). Function same as Laya.timer.frameOnce ().
Inherited From:
Parameters:
Name Type Attributes Default Description
delay int Delays several frames (frames per unit).
caller Object Execute domain (this)
method function Callback method at the end
args Array <optional>
null args Optional callback parameters
coverBefore Boolean (optional) whether the delay is covered before default is true

fromImage(url) → {Sprite}

Create a new one based on the image address Sprite Object is used to load and display this picture.
Inherited From:
Parameters:
Name Type Description
url String Picture address.
Returns:
Type:
Sprite
Returns the new Sprite object.

fromParentPoint(point) → {Point}

Converts the parent container coordinate to the local coordinate system.
Inherited From:
Parameters:
Name Type Description
point Point Parent container coordinate point.
Returns:
Type:
Point
Converted point.

getBounds() → {Rectangle}

Gets the rectangular display area of the object in the parent container coordinate system.

Be careful: The amount of calculation is large, as little as possible.

Inherited From:
Returns:
Type:
Rectangle
Rectangular region.

getChildAt(index) → {Node}

Gets the child node object based on the index position of the child node.
Overrides:
Parameters:
Name Type Description
index int Index location
Returns:
Type:
Node
Child node

getChildByName(name) → {Node}

Gets the child node object based on the name of the child node.
Overrides:
Parameters:
Name Type Description
name String Child node name.
Returns:
Type:
Node
Node object.

getChildIndex(node) → {int}

Gets the index position of the child node based on the child node object.
Overrides:
Parameters:
Name Type Description
node Node Child node.
Returns:
Type:
int
The index position at which the child node is located.

getGraphicBounds(realSize) → {Rectangle}

Returns the drawing object in this instance Graphics A display area that does not include child objects.
Inherited From:
Parameters:
Name Type Description
realSize Boolean (optional) use the true size of the picture, and defaults to false
Returns:
Type:
Rectangle
A Rectangle object that represents the captured display area.

getMousePoint()

Gets the mouse coordinate information relative to this object.
Inherited From:

getSelfBounds() → {Rectangle}

Gets the rectangular display area of the object in its own coordinate system.

Be careful: The amount of calculation is large, as little as possible.

Inherited From:
Returns:
Type:
Rectangle
Rectangular region.

globalToLocal(point, createNewPoint) → {Point}

Converts the global coordinates of stage to local coordinates.
Inherited From:
Parameters:
Name Type Description
point Point Global coordinate point.
createNewPoint Boolean (optional) whether to create a new Point object as the return value, defaults to false, returns the object creation cost using the input point object.
Returns:
Type:
Point
The point at which the coordinates are converted.

hasListener(type) → {Boolean}

inspect EventDispatcher Object registers any listeners for a particular event type.
Inherited From:
Parameters:
Name Type Description
type String Event type.
Returns:
Type:
Boolean
If the specified type of listener has been registered, the value is true; otherwise, the value is false.

hitTestPoint(x, y) → {Boolean}

Detects if a point is within this object.
Inherited From:
Parameters:
Name Type Description
x Number Global x coordinates.
y Number Global y coordinates.
Returns:
Type:
Boolean
Indicates whether it is within an object.

initialize()

Control initialization.

Inherited From:

isMouseEvent(type) → {Boolean}

Detects whether the specified event type is a mouse event.
Inherited From:
Parameters:
Name Type Description
type String Event type.
Returns:
Type:
Boolean
If it is a mouse event, the value is true; otherwise, the value is false.

loadImage(url, xopt, yopt, widthopt, heightopt, completeopt) → {Sprite}

Load and display a picture. The function is equivalent to the graphics.loadImage method. Support asynchronous loading.

Note: many calls to loadImage draw different pictures, which will be displayed simultaneously.

Inherited From:
Parameters:
Name Type Attributes Default Description
url String Picture address.
x Number <optional>
0 x (optional) displays the x position of the picture.
y Number <optional>
0 y (optional) displays the Y position of the picture.
width Number <optional>
0 width (optional) display the width of the picture, set to 0, which indicates the default width of the picture.
height Number <optional>
0 height (optional) display the height of the picture, set to 0, which indicates the default height to use the picture.
complete Handler <optional>
null complete (optional) the load completes the callback.
Returns:
Type:
Sprite
Returns the sprite object itself.

localToGlobal(point, createNewPoint) → {Point}

Converts local coordinates to global coordinates relative to stage.
Inherited From:
Parameters:
Name Type Description
point Point Local coordinate point.
createNewPoint Boolean (optional) whether to create a new Point object as the return value, defaults to false, returns the object creation cost using the input point object.
Returns:
Type:
Point
The point at which the coordinates are converted.

off(type, caller, listener, onceOnly) → {EventDispatcher}

from EventDispatcher Delete listeners in object.
Inherited From:
Parameters:
Name Type Description
type String Event type.
caller Object The domain of the event listener function.
listener function Event listener function.
onceOnly Boolean (optional) if the value is true, only the listeners added by the once method are removed.
Returns:
Type:
EventDispatcher
this EventDispatcher Object.

offAll(typeopt) → {EventDispatcher}

from EventDispatcher Removes all listeners that specify the type of event in the object.
Inherited From:
Parameters:
Name Type Attributes Default Description
type String <optional>
null type (optional) event type. If the value is null, all types of listeners for this object are removed.
Returns:
Type:
EventDispatcher
this EventDispatcher Object.

on(type, caller, listener, argsopt) → {EventDispatcher}

Adds an event listener to enable listeners to receive event notifications.

If you listen to mouse events, you automatically set the property of your own and father nodes. The value of mouseEnabled is true (if the parent node is mouseEnabled=false, then stop setting the parent node mouseEnabled attribute).

Inherited From:
Parameters:
Name Type Attributes Default Description
type String Event type.
caller Object The domain of the event listener function.
listener function Event listener function.
args Array <optional>
null args Optional callback parameters for the event listener function.
Returns:
Type:
EventDispatcher
This EventDispatcher object.

once(type, caller, listener, argsopt) → {EventDispatcher}

Adds an event listener to enable listeners to receive event notifications that automatically remove listeners after the listener event responds.

If you listen to mouse events, you automatically set the property of your own and father nodes. The value of mouseEnabled is true (if the parent node is mouseEnabled=false, then stop setting the parent node mouseEnabled attribute).

Inherited From:
Parameters:
Name Type Attributes Default Description
type String Event type.
caller Object The domain of the event listener function.
listener function Event listener function.
args Array <optional>
null args Optional callback parameters for the event listener function.
Returns:
Type:
EventDispatcher
This EventDispatcher object.

onCompResize()

Parent container Event.RESIZE Event listener processing function.
Inherited From:

parentRepaint()

CacheAs sets the cache invalidation for all parent objects.
Inherited From:

pivot(x, y) → {Sprite}

Set pivot point. Equivalent to setting the pivotX and pivotY attributes, respectively.

Because the return value is the Sprite object itself, you can use the following syntax: spr.pivot (...).Pos (50, 100);

Inherited From:
Parameters:
Name Type Description
x Number X axis point.
y Number Y axis point.
Returns:
Type:
Sprite
Returns the object itself.

pos(x, y, speedMode) → {Sprite}

Set coordinate position. Equivalent to setting the X and Y attributes, respectively.

Because the return value is the Sprite object itself, you can use the following syntax: spr.pos (...).Scale (...);

Inherited From:
Parameters:
Name Type Description
x Number X axis coordinate.
y Number Y axis coordinate.
speedMode Boolean (optional) is the speed model, the normal call this.x=value assignment, speed mode calls the internal function directly, if not rewritten x, y property, the proposed set to fast mode, higher performance.
Returns:
Type:
Sprite
Returns the object itself.

preinitialize()

Pre initialization.

Inherited From:

reCache()

In the case of setting up cacheAs, calling this method refreshes the cache.
Inherited From:

refresh()

Refresh scroll content.

removeChild(node) → {Node}

Delete child node.
Overrides:
Parameters:
Name Type Description
node Node Child node
Returns:
Type:
Node
Deleted nodes

removeChildAt(index) → {Node}

Deletes the corresponding child node object according to the index location of the child node.
Overrides:
Parameters:
Name Type Description
index int Node index location.
Returns:
Type:
Node
Deleted nodes.

removeChildByName(name) → {Node}

Deletes the corresponding child node object based on the child node name and, if not found, does not throw an exception.
Inherited From:
Parameters:
Name Type Description
name String Object name.
Returns:
Type:
Node
Node found ( Node Objects.

removeChildren(beginIndexopt, endIndexopt) → {Node}

Removes all child objects from the specified index interval.
Overrides:
Parameters:
Name Type Attributes Default Description
beginIndex int <optional>
0 beginIndex Start index.
endIndex int <optional>
0x7fffffff endIndex End index.
Returns:
Type:
Node
Current node object.

removeSelf() → {Node}

Remove yourself from the parent container. If you have been deleted, no exception will be thrown.
Inherited From:
Returns:
Type:
Node
Current node ( Node Objects.

render(context, x, y)

Update, render display objects. Call by system.
Inherited From:
Parameters:
Name Type Description
context RenderContext Rendering context references.
x Number X axis coordinate.
y Number Y axis coordinate.

repaint()

After cacheAs, the settings themselves and the parent object cache fail.
Inherited From:

replaceChild(newNode, oldNode) → {Node}

Replace child node.
Inherited From:
Parameters:
Name Type Description
newNode Node New node.
oldNode Node Old node.
Returns:
Type:
Node
Return new node.

resetLayoutX()

Reset object X

Inherited From:

resetLayoutY()

Reset object Y

Inherited From:

runCallLater(method)

If there is a need, a function that calls is delayed callLater Function setting, and the call function is immediately executed.

Inherited From:
See:
  • Panel.html#callLater()">#callLater()
Parameters:
Name Type Description
method function The name of the function to perform. For example, functionName.

scale(scaleX, scaleY, speedMode) → {Sprite}

Set zoom. Equivalent to setting the scaleX and scaleY attributes, respectively.

Because the return value is the Sprite object itself, you can use the following syntax: spr.scale (...).Pos (50, 100);

Inherited From:
Parameters:
Name Type Description
scaleX Number X axis scaling.
scaleY Number Y axis scaling.
speedMode Boolean (optional) whether the speed mode is called this.scaleX=value, normal assignment, speed mode directly call internal function, if not override the scaleX property of the scaleY, suggests setting for the rapid mode of higher performance.
Returns:
Type:
Sprite
Returns the object itself.

scrollTo(xopt, yopt)

Scroll the content container to the set vertical and horizontal scroll bar position.

Parameters:
Name Type Attributes Default Description
x Number <optional>
0 x Horizontal scroll bar property value value. Scroll bar position number.
y Number <optional>
0 y Vertical scroll bar property value value. Scroll bar position number.

setChildIndex(node, index) → {Node}

Sets the index position of the child node.
Inherited From:
Parameters:
Name Type Description
node Node Child node.
index int New index.
Returns:
Type:
Node
Returns the child node itself.

setSelfBounds(bound)

Set object bounds size, if you have settings, then no longer through the getBounds calculation, reasonable use can improve performance.
Inherited From:
Parameters:
Name Type Description
bound Rectangle Bounds rectangular region

size(width, hegiht) → {Sprite}

Set width height. Equivalent to setting the width and height attributes, respectively.

Because the return value is the Sprite object itself, you can use the following syntax: spr.size (...).Pos (50, 100);

Inherited From:
Parameters:
Name Type Description
width Number Width value.
hegiht Number Height value.
Returns:
Type:
Sprite
Returns the object itself.

skew(skewX, skewY) → {Sprite}

Set tilt angle. Equivalent to setting the skewX and skewY attributes, respectively.

Because the return value is the Sprite object itself, you can use the following syntax: spr.skew (...).Pos (50, 100);

Inherited From:
Parameters:
Name Type Description
skewX Number Horizontal tilt angle.
skewY Number Vertical inclination angle.
Returns:
Type:
Sprite
Returns the object itself

startDrag(areaopt, hasInertia, elasticDistanceopt, elasticBackTimeopt, dataopt, disableMouseEvent, ratioopt)

Drag to start this object.
Inherited From:
Parameters:
Name Type Attributes Default Description
area Rectangle <optional>
null area (optional) drag area, this area is the current object, registration point, active area (excluding the object width, height), optional.
hasInertia Boolean (optional) after the mouse is released, is it still inertial sliding, default is false, optional.
elasticDistance Number <optional>
0 elasticDistance (optional) the distance of the rubber band effect, 0 is the effect without rubber band, and the default is 0.
elasticBackTime int <optional>
300 elasticBackTime (optional) the rebound time of the rubber band is in milliseconds, and the default is 300 ms, optional.
data Object <optional>
null data (optional) dragging events with optional data.
disableMouseEvent Boolean (optional) disables mouse detection of other objects, defaults to false, and sets to true to improve performance.
ratio Number <optional>
0.92 ratio (optional) inertial damping coefficient, which affects inertia strength and duration.

stopDrag()

Stop dragging this object.
Inherited From:

timerLoop(delay, caller, method, argsopt, coverBefore, jumpFrame)

Execute a function repeatedly at regular intervals. Function same as Laya.timer.timerLoop ().
Inherited From:
Parameters:
Name Type Attributes Default Description
delay int Interval time (ms per unit).
caller Object Execute domain (this).
method function Callback method at the end.
args Array <optional>
null args Optional callback parameters.
coverBefore Boolean (optional) whether the delay is covered before default is true.
jumpFrame Boolean The clock is skipping. Time based callback, in the unit time interval, if you can perform multiple callbacks, for performance reasons, the engine defaults to only once. After setting the jumpFrame=true, the callback is executed several times in succession

timerOnce(delay, caller, method, argsopt, coverBefore)

Execute a function at regular intervals. Function same as Laya.timer.timerOnce ().
Inherited From:
Parameters:
Name Type Attributes Default Description
delay int Delay time (in milliseconds).
caller Object Execute domain (this).
method function Callback method at the end.
args Array <optional>
null args Optional callback parameters.
coverBefore Boolean (optional) whether the delay is covered before default is true.

toParentPoint(point) → {Point}

Converts the local coordinate system to the parent container coordinate system.
Inherited From:
Parameters:
Name Type Description
point Point Local coordinate point.
Returns:
Type:
Point
Converted point.

updateZOrder()

Reordering according to zOrder.
Inherited From:

Event

added

Inherited From:
See:
  • events.Event

click

Inherited From:
See:
  • events.Event

display

Inherited From:
See:
  • events.Event

dragend

Inherited From:
See:
  • events.Event

dragmove

Inherited From:
See:
  • events.Event

dragstart

Inherited From:
See:
  • events.Event

mousedown

Inherited From:
See:
  • events.Event

mousemove

Inherited From:
See:
  • events.Event

mouseout

Inherited From:
See:
  • events.Event

mouseover

Inherited From:
See:
  • events.Event

mouseup

Inherited From:
See:
  • events.Event

removed

Inherited From:
See:
  • events.Event

resize

Inherited From:
See:
  • events.Event

undisplay

Inherited From:
See:
  • events.Event