Button

From KickApps Documentation

Jump to: navigation, search

The button component has 6 states, a variety of styling options, and, most importantly, it can be used to execute any action. The button component is used for all the buttons in advanced video and audio players.

ButtonComponent2.png

Contents

About Button States

ButtonStates.png
Buttons have 6 states. These states are defined by what the user is doing with the mouse, and whether the button is in its "Toggled", or "on" state:

  • Up
    • The button's normal state. The mouse is not hovering over the button.
  • Hover
    • The mouse is hovering over the button.
  • Down
    • The mouse is being clicked over the button.
  • Toggle Up
    • Buttons with the togglable property enabled have a toggled state, which the button will assume when it is clicked. When clicked again, the button will return to its normal, non-toggled state. The "Toggle Up" state represents the button in its toggled state when the mouse is not over the button and the user isn't clicking the button.
  • Toggle Hover
    • The button is toggled, and the user's mouse is hovering over the button.
  • Toggle Down
    • The button is toggled, and the mouse is being clicked over the button.

Properties

Properties are configurable aspects of a component that let you customize the way it looks and how it works by changing their values in its configuration panel in the App Studio. You can also use JavaScript to change widget properties after the widget loads on a page using the setComponentProperty() method method of the Widget JavaScript API. Finally, you can use widget property values in Actions using our bracket literal syntax. For a listing of all properties on KickApps components, see our Properties Reference.

Togglable
Whether the button will have a "toggled", or "on" state. When this option is enabled, clicking on the button for the first time will put it in its "toggled" state. Clicking again will put the button back in its normal "Up" state. The "toggled" property can also be set via Actions.
Start in toggled state
When the togglable checkbox has been selected, a second checkbox will appear: "toggled". Selecting this option will load the button in its toggled state.

Content

Define the label that will appear centered on your button.

Background & Border

Background & Border properties can be applied to buttons in each of their 6 states. To apply styles for a particular state, select the tab that corresponds to that state.

Button background image
Enter the URL to an image file in .jpg, .gif, or .png format, or click Browse to open the App Studio Assets window, where you can either select an image you've already uploaded, or upload new images. You can select an image from your App Studio Assets by double-clicking on its icon or by dragging and dropping the icon into the Background Image input field. Please note: background images are applied to buttons as bitmap fills, which means that the bytes from the background image file are painted onto the button component as a texture, rather than simply rendering the source image. The process of painting the image's bytes like this will not always result in an exact reproduction of the image--even if the button component is exactly the same size as the background image--so if you need pixel perfection, apply your image as an Icon rather than a Background Image.
  • Tile Image
    • Repeat the image in the X and Y directions to fill the area of the Button component
  • Scale Image
    • Expand or contract the image to fit the area of the Button component
Button icon image
Enter the URL to an image file in .jpg, .gif, or .png format, or click Browse to open the App Studio Assets window. You can select an image from your App Studio Assets by double-clicking on its icon or by dragging and dropping the icon into the Icon input field, or upload a new image by clicking Add. Your selected image will be centered horizontally and vertically within the selected component.

The scrubber component is used in conjunction with the video and audio players to change positions in the video or audio track that's currently playing.
ScrubberComponent.png


Properties

  • Layout
    • Horizontal
    • Vertical
  • Handle Dimensions
    • Width
    • Height

Background & Border

The play progress bar, load progress bar, handle, and background elements of the scrubber can all be styled individually, with the following options:

Icon URL
Enter the URL to an image file in .jpg, .gif, or .png format, or click Browse to open the App Studio Assets window. You can select an image from your App Studio Assets by double-clicking on its icon, or upload a new image by clicking Add. Your selected image will be centered horizontally and vertically within the selected component.

Layout

There are two types of containers: the widget canvas itself (background of the entire widget) is considered a container, and you can also create containers that enclose components within your widget. Like any standard component, containers that you create can be moved around the stage, resized, and styled. The most powerful feature of Containers, though, is their ability to fix the positions of their constituent components via layout constraints, which we'll cover below. To create a container, select multiple components, right-click, and select "Group in new container".

group_in_container.png

You can configure a container's background color, opacity, border color, border thickness, corner radius, and background image in its Properties panel:

container_properties.png

You can also mask content in a container by selecting the Mask Content checkbox at the bottom of the panel above. With masking enabled, components that belong to the container but fall outside its bounds will be hidden. To indicate this, when you're editing a container that has masking enabled in Design mode, and then add a component outside the bounds of the container you're in, that component will be translucent:

component_outside_container_mask.png

Masking is useful for situations in which you want to animate a component into a container after it loads initially.

Layout Constraints

Layout constraints let you anchor components a certain distance away from the sides and axes of their containers. Components with layout constraints enabled maintain their offset distances when their containers are resized. To set layout constraints, double click on your container, then single click on a component within it. The Layout Constraints panel will appear:

layout_panel.png

The checkboxes along the top side of the square in the Layout Constraints panel can be used to anchor the selected component to the left, vertical center, and right sides of its container. The checkboxes along the left side of the square can be used to anchor the selected component to the top, horizontal center, and bottom sides of its container.

When you select a checkbox, a text input field appears across the box from it. The number in this field represents the offset distance, in pixels, from the selected side of the container. For example, this is what it looks like when you anchor to the left side:

left_narrow.png

If you then resize this container, the component maintains its distance from the left side:

left_wide.png

Similarly, you can anchor a component to the top of its container, and it will maintain its distance from the top when its container is resized:

top_short.png

top_tall.png

You can also anchor components to the horizontal and vertical center lines of their containers. This component is anchored to the horizontal center of its container. It maintains its distance from the horizontal center when its container is resized.

horz_cntr_short.png

horz_cntr_tall.png

This component is anchored to the vertical center of its container. It maintains its distance from the vertical center when its container is resized.

vert_cntr_narrow.png

vert_cntr_wide.png


Components anchored to opposite sides of their containers expand and contract to maintain their offsets. Below is a component anchored to both the left and right sides of its container. Note how it expands to maintain its distances from the left and right sides.

left_and_right_narrow.png left_and_right_wide.png

The component below is anchored to both the top and bottom sides of its container. It contracts when its container is resized.

top_bottom_tall.png


Events

Standard Events

  • Click Grey-apple-icon.png
  • Component hidden
  • Component loaded
  • Component shown
  • Double click
  • Mouse down Grey-apple-icon.png
  • Mouse up Grey-apple-icon.png
  • Roll out
  • Roll over

Actions

Standard Actions

  • Drag/Stop Drag
  • Set depth
  • Show/Hide Grey-apple-icon.png
  • Tween Blur
  • Tween Color
  • Tween Drop Shadow
  • Tween Glow
  • Tween Property
  • Update Property Grey-apple-icon.png

Fonts

FontStates.png
Button labels can be styled differently in all 6 button states. To apply styles for a particular state, select the tab that corresponds to that state.

Font
Choose the typeface you'd like to use.
Use embedded font
Embedded fonts are literally embedded into your widget, which means that your text will be visible to anyone who views your widget in the selected typeface with the properties you've set. Un-checking "Use embedded font" enables you to pick a font from your machine. When other people view your widget, they will see your text in the same font if they have that font on their machines; otherwise the widget will pick the closest approximation to this font from the embedded fonts and will render your text in this closest approximation. If you need to use characters that are not included in the English language, you'll need to de-select "Use embedded fonts".
Font style
  • Bold
  • Italic
  • Underline
Font color
Font size
6pt - 28pt
Alignment
  • Left
  • Right
  • Center

Layout

There are two types of containers: the widget canvas itself (background of the entire widget) is considered a container, and you can also create containers that enclose components within your widget. Like any standard component, containers that you create can be moved around the stage, resized, and styled. The most powerful feature of Containers, though, is their ability to fix the positions of their constituent components via layout constraints, which we'll cover below. To create a container, select multiple components, right-click, and select "Group in new container".

group_in_container.png

You can configure a container's background color, opacity, border color, border thickness, corner radius, and background image in its Properties panel:

container_properties.png

You can also mask content in a container by selecting the Mask Content checkbox at the bottom of the panel above. With masking enabled, components that belong to the container but fall outside its bounds will be hidden. To indicate this, when you're editing a container that has masking enabled in Design mode, and then add a component outside the bounds of the container you're in, that component will be translucent:

component_outside_container_mask.png

Masking is useful for situations in which you want to animate a component into a container after it loads initially.

Layout Constraints

Layout constraints let you anchor components a certain distance away from the sides and axes of their containers. Components with layout constraints enabled maintain their offset distances when their containers are resized. To set layout constraints, double click on your container, then single click on a component within it. The Layout Constraints panel will appear:

layout_panel.png

The checkboxes along the top side of the square in the Layout Constraints panel can be used to anchor the selected component to the left, vertical center, and right sides of its container. The checkboxes along the left side of the square can be used to anchor the selected component to the top, horizontal center, and bottom sides of its container.

When you select a checkbox, a text input field appears across the box from it. The number in this field represents the offset distance, in pixels, from the selected side of the container. For example, this is what it looks like when you anchor to the left side:

left_narrow.png

If you then resize this container, the component maintains its distance from the left side:

left_wide.png

Similarly, you can anchor a component to the top of its container, and it will maintain its distance from the top when its container is resized:

top_short.png

top_tall.png

You can also anchor components to the horizontal and vertical center lines of their containers. This component is anchored to the horizontal center of its container. It maintains its distance from the horizontal center when its container is resized.

horz_cntr_short.png

horz_cntr_tall.png

This component is anchored to the vertical center of its container. It maintains its distance from the vertical center when its container is resized.

vert_cntr_narrow.png

vert_cntr_wide.png


Components anchored to opposite sides of their containers expand and contract to maintain their offsets. Below is a component anchored to both the left and right sides of its container. Note how it expands to maintain its distances from the left and right sides.

left_and_right_narrow.png left_and_right_wide.png

The component below is anchored to both the top and bottom sides of its container. It contracts when its container is resized.

top_bottom_tall.png


Events

Standard Events

  • Click Html-icon.png
  • Component hidden Html-icon.png
  • Component loaded Html-icon.png
  • Component shown Html-icon.png
  • Double click Html-icon.png
  • Mouse down Html-icon.png
  • Mouse up Html-icon.png
  • Roll out Html-icon.png
  • Roll over Html-icon.png

Button Events

  • Toggled On Html-icon.png
    • Issued whenever the button's "toggled" property changes from false to true. By default, this event is issued when the user clicks a button for the first, third, fifth, etc., time.
  • Toggled Off Html-icon.png
    • Issued whenever the button's "toggled" property changes from true to false. By default, this event is issued when the user clicks a button for the second, fourth, sixth, etc., time.

Actions

Standard Actions

  • Drag/Stop Drag
  • Set depth
  • Show/Hide Grey-apple-icon.png
  • Tween Blur
  • Tween Color
  • Tween Drop Shadow
  • Tween Glow
  • Tween Property
  • Update Property Grey-apple-icon.png