<button>

The button class provides a simple pushbutton.

JavaScript: button

Extends Basebutton

The <button> tag provides a simple button. The button is rectangular and typically displays a text label describing its action. The button adjusts to fit the label.

Example 1. Simple button
<canvas height="30">	
  <button onclick="animate('x', 100, 1000, true)">
    Move me
  </button>
</canvas>

If you need to format the text using additional tags such as <b>, add the text inside the button tags instead of using the text attribute.

Example 2. XHTML button
<canvas height="30">	
  <button onclick="animate('x', 100, 1000, true)">
    Move <b>me</b>
  </button>
</canvas>

A <button> may contain both XHTML markup, and object tags such as <attribute> and <method>.

Example 3. XHTML button
<canvas height="30">	
  <button onclick="moveHoriz(5);">
    Move <b>me</b>
    <method name="moveHoriz" args="moveAmount">
      this.setAttribute("x", this.x+moveAmount);
    </method>
  </button>
</canvas>
See Also:
Attributes
Name Usage Type (Tag) Type (JS) Default Category
text_padding_x Tag & JS number Number 11 setter
 

the amount of space to add horizontally when sizing button to its text. default: 11


text_padding_y Tag & JS number Number 4 setter
 

the amount of space to add vertically when sizing button to its text. default: 4


text_x Tag & JS number Number   setter
 

the x position of the button text. default: centered


text_y Tag & JS number Number   setter
 

the y position of the button text. default: centered



Attributes inherited from Basebutton

disabledResourceNumber, downResourceNumber, maxframes, normalResourceNumber, onresourceviewcount, overResourceNumber, reference, resourceviewcount, respondtomouseout

Attributes inherited from Basecomponent

doesenter, enabled, hasdefault, isdefault, style, styleable, text

Attributes inherited from Node

class, classroot, cloneManager, datapath, id, ignoreAttribute, ignoreplacement, immediateparent, initstage, name, nodeLevel, onconstruct, oninit, parent, placement, subnodes

Attributes inherited from View

aaactive, aadescription, aaname, aasilent, aatabindex, align, bgcolor, clickable, clickregion, clip, cursor, defaultplacement, fgcolor, focusable, focustrap, font, fontsize, fontstyle, frame, framesloadratio, hassetheight, hassetwidth, height, layout, loadratio, mask, onblur, onclick, ondata, ondblclick, onfocus, onkeydown, onkeyup, onmousedown, onmouseout, onmouseover, onmouseup, onselect, opacity, options, pixellock, play, resource, resourceheight, resourcewidth, rotation, selectiontype, showhandcursor, source, stretches, subviews, totalframes, unstretchedheight, unstretchedwidth, valign, visible, width, x, xoffset, y, yoffset


Methods

doEnterDown()
button.doEnterDown()

Called by the button manager when this button is the default



doEnterUp()
button.doEnterUp()

Called by the button manager when this button is the default



Methods inherited from basebutton

doSpaceDown, doSpaceUp, setResourceViewCount, showDown, showOver, showUp

Methods inherited from basecomponent

doEnterDown, doEnterUp, setStyle, setTint, updateDefault

Methods inherited from LzNode

animate, applyConstraint, applyData, childOf, completeInstantiation, createChildren, dataBindAttribute, destroy, determinePlacement, getAttribute, getOption, getUID, lookupSourceLocator, searchImmediateSubnodes, searchSubnodes, setAttribute, setDatapath, setID, setName, setOption

Methods inherited from LzView

addProxyPolicy, addSubview, bringToFront, construct, containsPt, getAttributeRelative, getBounds, getColor, getColorTransform, getContextMenu, getCurrentTime, getDepthList, getHeight, getID3, getMouse, getPan, getTotalTime, getVolume, getWidth, init, measureHeight, measureWidth, play, releaseLayouts, removeProxyPolicy, searchParents, searchSubviews, seek, sendBehind, sendInFrontOf, sendToBack, setAAActive, setAADescription, setAAName, setAASilent, setAATabIndex, setAlign, setAttributeRelative, setBGColor, setClickable, setColor, setColorTransform, setContextMenu, setCursor, setHeight, setLayout, setOpacity, setPan, setPlay, setResource, setResourceNumber, setRotation, setShowHandCursor, setSource, setValign, setVisible, setVolume, setWidth, setX, setY, shouldYieldFocus, stop, stretchResource, unload, updateResourceSize


Events

Events inherited from LzNode

onconstruct, ondata, oninit

Events inherited from LzView

onaddsubresource, onaddsubview, onblur, onclick, ondblclick, onerror, onfocus, onframe, onheight, onlastframe, onload, onmousedown, onmousedragin, onmousedragout, onmouseout, onmouseover, onmouseup, onmouseupoutside, onopacity, onplay, onremovesubview, onstop, ontimeout, onwidth, onx, ony