Core. Input

Input Class is used to create display objects to display and type text.

Input Class encapsulates the native text input box, and because of the differences in browsers, the default text position of the object is slightly off where the user clicks on the text at the time of the input.

Constructor

new Input()

Create a new one Input Class instance.

Extends

Member

(static) IOS_IFRAME :Boolean

(static) isInputting :Boolean

Indicates whether the input is in status.

(static) TYPE_DATE :String

Default Value:
  • "date"

(static) TYPE_DATE_TIME :String

Default Value:
  • "datetime"

(static) TYPE_DATE_TIME_LOCAL :String

Default Value:
  • "datetime-local"

(static) TYPE_EMAIL :String

Default Value:
  • "email"

(static) TYPE_MONTH :String

Default Value:
  • "month"

(static) TYPE_NUMBER :String

Default Value:
  • "number"

(static) TYPE_PASSWORD :String

Default Value:
  • "password"

(static) TYPE_RANGE :String

Default Value:
  • "range"
Default Value:
  • "search"

(static) TYPE_TEXT :String

Default Value:
  • "text"

(static) TYPE_TIME :String

Default Value:
  • "time"

(static) TYPE_URL :String

Default Value:
  • "url"

(static) TYPE_WEEK :String

Default Value:
  • "week"

_words

Inherited From:

align :String

Represents the horizontal display of text.

Value:

  • "Left": left justified display.
  • "Center": Centered display.
  • "Right": right justified display.
  • *

    Inherited From:

    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:

    asPassword :Boolean

    This API is deprecated. Use the type= "password" instead of setting asPassword, and asPassword will be deleted at the next major update.

    Specifies whether the text field is a password text field.

    If the value of this property is true, the text field is considered a password text field, and the input characters are hidden by using an asterisk rather than the actual character. If false, the text field is not considered a password text field.

    The default value is false.

    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:

    bgColor :String

    The text background color is represented as a string.
    Inherited From:

    blendMode :String

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

    bold :Boolean

    Specifies whether the text is bold.

    The default value is false, which means that you do not use bold fonts. If the value is true, the text is bold.

    Inherited From:

    borderColor :String

    The text border color is represented as a string.
    Inherited From:

    cacheAs :String

    Specifies whether the display object is cached as a static image. When cacheAs is changed, the child object is automatically cached, and the reCache method is invoked manually to update the cache.

    It is proposed to cache complex content that is not constantly changing into a static image, which can greatly improve rendering performance. CacheAs has "None", "normal" and "bitmap". The three values are optional.

  • The default is "None" and does not do any caching.
  • When the value is "normal", the canvas cache is carried out in canvas mode, and the command cache is in webgl mode.
  • When bitmap is used, canvas mode is still the canvas cache, and the renderTarget buffer is used in webgl mode.
  • Webgl renderTarget cache model disadvantages: additional renderTarget objects will be created to increase memory overhead, cache area has a maximum 2048 restrictions, continuous redraw will increase CPU overhead. Advantages: drastically reduce drawcall, rendering the highest performance. *

    Inherited From:

    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:

    color :String

    Overrides:

    customRenderEnable :Boolean

    Inherited From:

    destroyed :Boolean

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

    displayedInStage :Boolean

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

    editable :Boolean

    filters :Array

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

    focus :Boolean

    Indicates whether the focus is on this instance.

    font :String

    The font name of a text, represented in a string.

    The default value is "Arial", and the default font can be set by Font.defaultFont.

    If the runtime system cannot find the set font, the text is rendered in the default font of the system, resulting in display anomalies. (usually displayed on the computer and displayed at some moving ends because of a lack of settings for fonts).

    Inherited From:
    See:
    • display.css.Font#defaultFamily

    fontSize :int

    Specifies the font size of a text (in pixels).

    The default is 20 pixels, which can be passed Text.defaultSize Set default size.

    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:

    height :Number

    Displays the height of the object, per pixel, and defaults to 0.

    This height is used for mouse collision detection and does not affect the display object image size. You need to zoom in on the image of the display object. Use scale, scaleX, and scaleY.

    You can get the actual height of the object image through getbounds.

    Inherited From:

    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优先检测此对象的子对象,当递归检测完所有子对象后,仍然没有找到目标对象,最后再检测此对象。

    inputElementXAdjuster :int

    The native input frame X axis adjustment value is used to adjust the input frame coordinates.

    Because even if the value is set, there is no agreement between platforms and browsers, and inputElementXAdjuster is deprecated.

    Deprecated:
    • Yes

    inputElementYAdjuster :int

    The native input frame Y axis adjustment value is used to adjust the input frame coordinates.

    Because even if the value is set, there is no agreement between platforms and browsers, and inputElementYAdjuster is deprecated.

    Deprecated:
    • Yes

    isChanged :Boolean

    Inherited From:

    italic :Boolean

    Indicates whether the text in this text format is italic.

    The default value is false, which means no italics. If the value is true, the text is italic.

    Inherited From:

    leading :Number

    Vertical line spacing (in pixels).
    Inherited From:

    lines :Array

    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:

    maxChars :int

    The character number is limited to 10000 by default.

    When setting the number of characters, a value of less than or equal to 0 will limit the number of characters to 10000.

    maxScrollX :int

    Gets the maximum horizontal scroll scroll value.
    Inherited From:

    maxScrollY :int

    Gets the maximum vertical scroll value.
    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:

    multiline :Boolean

    Indicates whether it is a multiline input box.

    name :String

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

    nativeInput :Object

    Gets a reference instance of the input box.

    numChildren :int

    Number of child objects.
    Inherited From:

    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:

    overflow :String

    Overflow specifies the behavior of text beyond the text field. Its values are "hidden", "visible" and "scroll".

    The performance is from high to low in order: Hidden > visible > scroll.

    Inherited From:
    Default Value:
    • VISIBLE

    padding :Array

    Margin information.

    Data format: [上边距,右边距,下边距,左边距] (margins are in pixels).

    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:

    prompt :String

    Set input prompt.

    promptColor :String

    Sets the input prompt color.

    restrict :String

    Restrict input characters.

    rotation :Number

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

    scaleX :Number

    X axis scaling value, defaults to 1. Set to negative, you can achieve horizontal inversion effects, such as scaleX=-1.
    Inherited From:

    scaleY :Number

    Y axis scaling value, defaults to 1. Set to negative, enabling vertical inversion, such as scaleX=-1.
    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:

    scrollX :Number

    Get horizontal scroll.
    Inherited From:

    scrollY :Number

    Get longitudinal scrolling.
    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:

    stroke :Number

    The stroke width (in pixels).

    The default value of 0, said no stroke.

    Inherited From:

    strokeColor :String

    Color color, expressed as a string.

    The default value is "#000000" (black);

    Inherited From:

    text :String

    Overrides:

    textHeight :Number

    Represents the height of the text, in pixels.
    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:

    textWidth :Number

    Represents the width of the text, in pixels.
    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:

    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:

    type :String

    The input box type is one of the static constants of the Input.

    • TYPE_TEXT
    • TYPE_PASSWORD
    • TYPE_EMAIL
    • TYPE_URL
    • TYPE_NUMBER
    • TYPE_RANGE
    • TYPE_DATE
    • TYPE_MONTH
    • TYPE_WEEK
    • TYPE_TIME
    • TYPE_DATE_TIME
    • TYPE_DATE_TIME_LOCAL
    • *

    Platform compatibility. See Synonyms at platform compatibility http://www.w3school.com.cn/html5/html_5_form_input_types.asp。

    underline :Boolean

    Inherited From:

    underlineColor :String

    Inherited From:

    valign :String

    Represents the vertical display of text.

    Value:

  • "Top": home top aligned display.
  • "Middle": Centered display.
  • "Bottom": bottom aligned display.
  • *

    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:

    width :Number

    Displays the width of the object, per pixel, and defaults to 0.

    This width is used for mouse collision detection and does not affect the display object image size. You need to zoom in on the image of the display object. Use scale, scaleX, and scaleY.

    You can get the actual width of the display object image through getbounds.

    Inherited From:

    wordWrap :Boolean

    Indicates whether the text is automatic, and defaults to false.

    If the value is true, the word is automatically delivered; otherwise, the line is not automatic.

    Inherited From:

    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

    _getTextStyle()

    Inherited From:

    _setParent()

    Inherited From:

    addChild(node) → {Node}

    Adding child nodes.
    Inherited From:
    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.
    Inherited From:
    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.

    changeText()

    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.

    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.

    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.

    Inherited From:
    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.
    Inherited From:

    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.

    getCharPoint(charIndex, outopt) → {Point}

    Returns the coordinates of the characters in the parent coordinate of this class instance.
    Inherited From:
    Parameters:
    Name Type Attributes Default Description
    charIndex int Index location.
    out Point <optional>
    null out (optional) output Point reference.
    Returns:
    Type:
    Point
    The coordinates of the Point characters in the parent coordinate of this class instance. If the out parameter is not null, the result is assigned to the specified Point object, otherwise a new Point object is created to return. Using Point.TEMP as a out parameter is recommended to save the overhead of Point object creation and garbage collection, especially in logic that requires frequent execution, such as frame loops and MOUSE_MOVE event callback functions.

    getChildAt(index) → {Node}

    Gets the child node object based on the index position of the child node.
    Inherited From:
    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.
    Inherited From:
    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.
    Inherited From:
    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.

    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.

    lang(text, arg1opt)

    According to the specified text, take the text content of the current language from the language package. And replace the {i} text in this text.

    Such as:

  • (1) the value of text is "my name", the language version of this text to take the corresponding values in the "My name", "My name" set the content for the current text.
  • (2) the value of text is "congratulations on winning {0} diamonds, {1} experience."." The value of arg1 is 100, and the value of arg2 is 200. The current version is the first language to this text corresponding to the values in the "Congratulations on your winning {0} diamonds, {1} experience", Then, the {0}, {1}, and the numbers in parentheses are replaced from 0 to the values of arg1 and arg2. Replace the processed text "Congratulations, on, your, winning, 100, diamonds, 200, experience." as the content of the current text. *
  • *

    Inherited From:
    Parameters:
    Name Type Attributes Default Description
    text String Text content.
    arg1 Object <optional>
    null ...args Text substitution parameter.

    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.

    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.

    reCache()

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

    registerBitmapFont(name, bitmapFont)

    Registered bitmap font.
    Inherited From:
    Parameters:
    Name Type Description
    name String The name of the bitmap font.
    bitmapFont BitmapFont Bitmap font file.

    removeChild(node) → {Node}

    Delete child node.
    Inherited From:
    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.
    Inherited From:
    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.
    Inherited From:
    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.
    Overrides:
    Parameters:
    Name Type Description
    context RenderContext Rendering context references.
    x Number X axis coordinate.
    y Number Y axis coordinate.

    renderText(begin, visibleLineCount)

    Render text.
    Inherited From:
    Parameters:
    Name Type Description
    begin The index of the line to start rendering.
    visibleLineCount Number of rows rendered.

    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.

    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.

    select()

    Select all text for the current instance.

    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.

    setSelection(startIndex, endIndex)

    Sets cursor position and selection characters.
    Parameters:
    Name Type Description
    startIndex int Cursor start position.
    endIndex int End of cursor position.

    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:

    supportFont(font) → {Boolean}

    Determines whether the system supports the specified font.
    Inherited From:
    Parameters:
    Name Type Description
    font String Support testing for font
    Returns:
    Type:
    Boolean
    True stands for system support

    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.

    typeset()

    Typeset text.

    Perform high and wide calculations, render, and redraw text.

    Inherited From:

    unregisterBitmapFont(name, destroy)

    Removes registered bitmap font files.
    Inherited From:
    Parameters:
    Name Type Description
    name String The name of the bitmap font.
    destroy Boolean Do you want to destroy the specified font file?.

    updateZOrder()

    Reordering according to zOrder.
    Inherited From:

    Event

    added

    Inherited From:
    See:
    • events.Event

    blur

    See:
    • events.Event

    change

    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

    enter

    See:
    • events.Event

    focus

    See:
    • events.Event

    input

    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

    undisplay

    Inherited From:
    See:
    • events.Event