FORGE. Button

new Button(viewer, configopt)

A button with three states with out, over and down.
Parameters:
Name Type Attributes Description
viewer FORGE.Viewer FORGE.Viewer reference.
config ButtonConfig <optional>
The button config.
Source:
To Do:
  • Add tween for properties
  • Ability to set image size to the defined width/height/padding/margin of the button

Extends

Members

(static, constant) states :Object

Button possible states
Type:
  • Object
Properties:
Name Type Description
OUT string
OVER string
DOWN string
Source:

(readonly) alive :boolean

Get the alive flag value of the object.
Type:
  • boolean
Inherited From:
Source:

alpha :number

Get and set the left alpha of this display object. (between 0 and 1).
Type:
  • number
Inherited From:
Source:

autoHeight :boolean

Get and set the flag for auto size on height.
Type:
  • boolean
Source:

autoWidth :boolean

Get and set the flag for auto size on width.
Type:
  • boolean
Source:

background :string

Get and set the backgound CSS value of this display object.
Type:
  • string
Inherited From:
Source:

borderColor :string

Get and set the border-color CSS value of this display object.
Type:
  • string
Inherited From:
Source:

borderRadius :number

Get and set the border-radius CSS value of this display object.
Type:
  • number
Inherited From:
Source:

borderStyle :string

Get and set the border-style CSS value of this display object.
Type:
  • string
Inherited From:
Source:

borderWidth :number

Get and set the border-width CSS value of this display object.
Type:
  • number
Inherited From:
Source:

(nullable) bottom :number

Get and set the bottom anchor of this display object.
Type:
  • number
Inherited From:
Source:

(readonly) children :Array

Get the children array.
Type:
  • Array
Inherited From:
Source:

(readonly) className :string

Get the class name of the object.
Type:
  • string
Inherited From:
Source:

data :*

Get and set any custom data you want to associate to this object.
Type:
  • *
Inherited From:
Source:

debug :boolean

Get and set the debug flag.
Type:
  • boolean
Inherited From:
Source:

(readonly) dom :Element|HTMLElement

Get the dom element that compose this display object.
Type:
  • Element | HTMLElement
Inherited From:
Source:

(readonly) drag :FORGE.Drag

Get the FORGE.Drag object that handles drag events for this display object.
Type:
Inherited From:
Source:

fullscreen :boolean

Set the fullscreen property of this display object.
Type:
  • boolean
Inherited From:
Source:

(readonly) globalOffset :Object

Get the global offset
Type:
  • Object
Inherited From:
Source:

height :number|string

Get and set the height of this display object. The getter will always return a number, but you can pass to the setter either a number like 10 or a string like "10px" or "10%".
Type:
  • number | string
Inherited From:
Source:

horizontalCenter :boolean

Get and set the horizontal center status of this display object.
Type:
  • boolean
Inherited From:
Source:

id :string

Get and set the id of this display object.
Type:
  • string
Inherited From:
Source:

index :number

Get and set the index value of this display object. This is the z-index CSS property.
Type:
  • number
Inherited From:
Source:

(readonly) innerHeight :number

Get the inner height in pixels (understand height without borders) of this DisplayObject.
Type:
  • number
Inherited From:
Source:

(readonly) innerWidth :number

Get the inner width (understand width without borders) of this DisplayObject.
Type:
  • number
Inherited From:
Source:

keepRatio :boolean

Get and set the keepRatio status of this display object.
Type:
  • boolean
Inherited From:
Source:

(nullable) left :number

Get and set the left anchor of this display object.
Type:
  • number
Inherited From:
Source:

maximized :boolean

Get and set the maximized status of this display object.
Type:
  • boolean
Inherited From:
Source:

(readonly) onAddedToDom :FORGE.EventDispatcher

Get the "onAddedToDom" FORGE.EventDispatcher of this display object.
Type:
Inherited From:
Source:

(readonly) onAddedToParent :FORGE.EventDispatcher

Get the "onAddedToParent" FORGE.EventDispatcher of this display object.
Type:
Inherited From:
Source:

(readonly) onBorderChange :FORGE.EventDispatcher

Get the "onBorderResize" FORGE.EventDispatcher of this display object.
Type:
Inherited From:
Source:

(readonly) onDestroy :FORGE.EventDispatcher

Get the onDestroy FORGE.EventDispatcher, this event is emitted at the end of the destroy sequence.
Type:
Inherited From:
Source:

(readonly) onFullscreenEnter :FORGE.EventDispatcher

Get the "onFullscreenEnter" FORGE.EventDispatcher of this display object.
Type:
Inherited From:
Source:

(readonly) onFullscreenExit :FORGE.EventDispatcher

Get the "onFullscreenExit" FORGE.EventDispatcher of this display object.
Type:
Inherited From:
Source:

(readonly) onHide :FORGE.EventDispatcher

Get the "onHide" FORGE.EventDispatcher of this display object.
Type:
Inherited From:
Source:

(readonly) onMove :FORGE.EventDispatcher

Get the "onMove" FORGE.EventDispatcher of this display object.
This event is triggered when object's coordinate (x, y) changed.
Type:
Inherited From:
Source:

(readonly) onReady :FORGE.EventDispatcher

Get the "onReady" FORGE.EventDispatcher of this display object.
Type:
Inherited From:
Source:

(readonly) onResize :FORGE.EventDispatcher

Get the "onResize" FORGE.EventDispatcher of this display object.
Type:
Inherited From:
Source:

(readonly) onShow :FORGE.EventDispatcher

Get the "onShow" FORGE.EventDispatcher of this display object.
Type:
Inherited From:
Source:

oveflow :string

Get and set the overflow property.
Type:
  • string
Inherited From:
Source:

parent :FORGE.DisplayObjectContainer

Get and set the parent of this display object.
Type:
Inherited From:
Source:
To Do:
  • Find a clean way to identify DisplayObjectContainer and other class that inherits from.

percentHeight :number

Get and set the height of this display object in percent only.
Type:
  • number
Inherited From:
Source:

percentWidth :number

Get and set the width of this display object in percent only.
Type:
  • number
Inherited From:
Source:

pixelHeight :number

Get and set the height of this display object in pixel only.
Type:
  • number
Inherited From:
Source:

pixelWidth :number

Get and set the width of this display object in pixel only.
Type:
  • number
Inherited From:
Source:

(readonly) pointer :FORGE.Pointer

Get the FORGE.Pointer object that handles mouse and touch events for this display object.
Type:
Inherited From:
Source:

(readonly) ready :boolean

Get the ready status of this display object.
Type:
  • boolean
Inherited From:
Source:
Get and set the right anchor of this display object.
Type:
  • number
Inherited From:
Source:

rotation :number

Get and set the rotation of this display object. (in degree).
Type:
  • number
Inherited From:
Source:

skin :FORGE.ButtonSkin

Get and set the current skin.
Type:
Source:

(readonly) skins :Object

Get the skins list.
Type:
  • Object
Source:

(readonly) tags :Array

Get the tags associated to this object.
Type:
  • Array
Inherited From:
Source:

tooltip :string

Get and set the tooltip value of this display object. This is the title dom property.
Type:
  • string
Inherited From:
Source:

(nullable) top :number

Get and set the top anchor of this display object.
Type:
  • number
Inherited From:
Source:

(readonly) uid :string

Get the uid of the object.
Type:
  • string
Inherited From:
Source:

unitHeight :string

Get and set the height unit of this display object.
Type:
  • string
Inherited From:
Source:

unitWidth :string

Get and set the width unit of this display object.
Type:
  • string
Inherited From:
Source:

verticalCenter :boolean

Get and set the vertical center status of this display object.
Type:
  • boolean
Inherited From:
Source:

(readonly) viewer :FORGE.Viewer

Get the viewer reference object.
Type:
Inherited From:
Source:

visible :boolean

Get and set the visibility of this display object.
Type:
  • boolean
Inherited From:
Source:

warning :boolean

Get and set the warning flag.
Type:
  • boolean
Inherited From:
Source:

width :number|string

Get and set the width of this display object. The getter will always return a number, but you can pass to the setter either a number like 10 or a string like "10px" or "10%".
Type:
  • number | string
Inherited From:
Source:

x :number

Get and set the x position of this display object.
Type:
  • number
Inherited From:
Source:

y :number

Get and set the y position of this display object.
Type:
  • number
Inherited From:
Source:

Methods

addChild(child)

Add a child to this display object container.
Parameters:
Name Type Description
child FORGE.DisplayObject The FORGE.DisplayObject you want to add to this display object container.
Overrides:
Source:

addSkin(skin, setupopt)

Add a skin to the button
Parameters:
Name Type Attributes Description
skin FORGE.ButtonSkin The button skin you want to add to this button.
setup boolean <optional>
Does the skin you add should be defined as the new current skin.
Source:

destroy()

Destroy method.
Overrides:
Source:

empty(destroy)

Remove all children.
Parameters:
Name Type Description
destroy boolean Does the method should destroy the children in addtion of removing of the display list.
Inherited From:
Source:

fitToContent()

Make the container to fit content.
Inherited From:
Source:

fullscreenEnter()

Request a fullscreen enter on this display object.
Inherited From:
Source:

fullscreenExit()

Request a fullscreen exit on this display object.
Inherited From:
Source:

hasChild(child)

Check if a FORGE.DisplayObject is a child of this display object container.
Parameters:
Name Type Description
child FORGE.DisplayObject The FORGE.DisplayObject you want to check.
Inherited From:
Source:

hasSkin(name) → {boolean}

Does the button has a specified skin ?
Parameters:
Name Type Description
name string The name of the skin you want to check.
Source:
Returns:
Returns true if the button have a skin with asked name.
Type
boolean

hide()

Hide this display object.
Inherited From:
Source:

isFullscreen() → {boolean}

Know if this display object is in fullscreen
Inherited From:
Source:
Returns:
Type
boolean

isInDom() → {boolean}

Method to know if a display object is in dom.
Inherited From:
Source:
Returns:
Returns true if the display Object is in DOM, false if not.
Type
boolean

load(config)

Load a button configuration.
Parameters:
Name Type Description
config ButtonConfig | FORGE.ButtonSkin The button configuration to load.
Source:

log(value)

Basic log method, log a string in the console if debug is enabled.
Parameters:
Name Type Description
value * The value you want to log in the console.
Inherited From:
Source:

maximize(keepMaximized)

Maximize the size of this display object to the size of its parent.
Parameters:
Name Type Description
keepMaximized boolean Set this param to true if you want that this display object auto resize to max when its parent is resized.
Inherited From:
Source:

removeChild(child, destroyopt)

Remove a child from this display object container.
Parameters:
Name Type Attributes Description
child FORGE.DisplayObject The FORGE.DisplayObject you want to remove from this display object container.
destroy boolean <optional>
Does the container have to destroy the child that is removed.
Inherited From:
Source:

removeChildAt(index, destroyopt)

Remove child at a specific index.
Parameters:
Name Type Attributes Description
index number The index at which you want to remove the child .
destroy boolean <optional>
Does the method should destroy the child in addtion of removing of the display list.
Inherited From:
Source:

resize(width, height)

Resize this display object to a given width / height.
Parameters:
Name Type Description
width number | string The width you want to set, it can be for example 10, "10px" or "10%".
height number | string The height you want to set, it can be for example 10, "10px" or "10%".
Inherited From:
Source:

setSkin(value)

Set the button skin
Parameters:
Name Type Description
value string | FORGE.ButtonSkin Either an existing skin name or an existing or a new FORGE.ButtonSkin
Source:

show()

Show this display object.
Inherited From:
Source:

toggleVisibility()

Toggles th visibility of this display object.
Inherited From:
Source:

update()

Update method that is called only if the container is a root container.
Inherited From:
Source:

updateSkin()

Update the skin display, use this method if you change the skin and you need to update it.
Source:

warn(valuenullable)

Basic warn method, log a warn string in the console if warning is enabled.
Parameters:
Name Type Attributes Description
value string | Object <nullable>
The value you want to warn in the console.
Inherited From:
Source:

FORGE. Button

Members
Methods