Box
| ASUL Component | |
|---|---|
| Tag name | box
|
| Extends | AbstractAsulObject |
This is a primitive container. It is used as the base class for most other components.
Contents |
Attributes
|
|
See: AbstractAsulObject for inherited attributes. |
alpha
- Type: Number
- Default:
1
This defines the normal alpha (opacity) of the element. Can be a floating point value in an interval of [0, 1]. Default value is 1, i.e. fully visible.
Example
<box anchors="20,20,pw/2,ph-20" background="color(0x990000)" alpha="0.25"/> <box anchors="pw/2,20,pw-20,ph-20" background="color(0x990000)" alpha="0.75"/>
alpha_fadetime
- Type: Number
- Default:
0.25
This attribute only applies when alpha_out is set. In that case
it determines the time in milliseconds it should take for the shift from one
transparency to the other. Can be an integer value larger or equal to zero.
alpha_out
- Type: Number
- Default:
alpha
An alternative alpha value for when the mouse cursor is not hovering the object. As the normal alpha value, this can be a floating point value in an interval of [0, 1]. Defaults to the same value as given in alpha, so no fading.
Note: the element must be either mouseenabled or have mouseenabled children.
Example
<box anchors="20,20,pw-20,ph-20" background="color(0x990000)" alpha_out="0.5" mouseenabled="true" alpha_fadetime="2"/>
collapse_time
- Type: Number
- Default:
0.25
The time in seconds it should take to collapse the element to the collapse_height and collapse_width.
Example
<box x="20" y="20" width="60" height="60" background="color(0x990000)" collapse_height="30" collapse_time="0.5" mouseenabled="true"/>
collapse_height
- Type: Number
- Default:
height
The height to collapse the element to while it is not hovered by the mouse.
collapse_width
- Type: Number
- Default:
width
The width to collapse the element to while it is not hovered by the mouse.
filter
- Type: Definition
Set a filter effect for this element. Available filter are: glow, dropshadow, bevel and blur. Those simply create a filter as provided by the Flash API.
A filter has to be given in common definition format, i.e.
type(arguments). Multiple filters can be given when separated
by semicolons (;). The first argument is always the filter type, the
following arguments differ between the filter types, but are equivalent to
the arguments taken by the filter classes' constructors. Please refer to the
Flash API documentation for more information:
- Blur
- Bevel
- DropShadow and
- Glow
Example
<box anchors="0,0,pw,ph" background="color(0x660000)"> <box anchors="20,20,pw-20,ph-20" background="color(0x990000)" filter="dropshadow(2,45,0x000000,1,3,3,0.5,2); glow(0xFFFFFF,1,3,3,1,2)"/> </box>
mouseenabled
- Type: Boolean
- Default:
false
Whether this element is mouseenabled or not, i.e. whether the user can interact with this element element using the mouse or not. This must be set to true for all elements that should allow mouse interaction, e.g. buttons. This is also true if the element contains a loaded SWF file that should allow mouse interaction.
title
- Type: Definition or String
This can be used to assign a title to an element. If set, hovering the
element opens a tooltip with the specified text. This can also be a localize
definition, i.e. a string of the format localize(LOCALIZE_ID, Default text).
Note: the element must be either mouseenabled or have mouseenabled children.
Example
<box anchors="0,0,pw,ph" background="color(0x990000)" title="Title!" mouseenabled="true"/>
Event attributes
|
|
See: ASUL scripting for more information on scripts in the ASUL context. |
These attributes, defined the same way as other attributes, are special in such that they contain script code which is evaluated when an event corresponding to the attribute occurs. This is similar to the principle of event attributes in HTML, and naming was inspired by those.
Whenever the script in such an attribute is evaluated, a variable named event is made available in the script context. This variable will be the original ActionScript3 event variable representing the event.
In general it is possible to put any code whatsoever into event attributes, but for readability and reuseability it is recommended to define the actual handler functions in script block and then calling that function.
onadded
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's Event.ADDED occurs for this object.
onaddedtostage
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's Event.ADDED_TO_STAGE occurs for this object.
onclick
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's MouseEvent.CLICK occurs for this object.
Example
<button anchors="20,20,pw-20,ph-20" background="color(0x660000)" onclick="event.currentTarget.alpha=Math.random()"/>
oninvisible
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's VisibilityEvent.INVISIBLE occurs for this object, i.e. when its visibility property changes to true.
onkeydown
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's KeyboardEvent.KEY_DOWN occurs for this object.
onkeyup
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's KeyboardEvent.KEY_UP occurs for this object.
onmousedown
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's MouseEvent.MOUSE_DOWN occurs for this object.
onmousemove
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's MouseEvent.MOUSE_MOVE occurs for this object.
onmouseout
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's MouseEvent.MOUSE_OUT occurs for this object.
onmouseover
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's MouseEvent.MOUSE_OVER occurs for this object.
onmouseup
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's MouseEvent.MOUSE_UP occurs for this object.
onmousewheel
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's MouseEvent.MOUSE_WHEEL occurs for this object.
onremoved
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's Event.REMOVED occurs for this object.
onremovedfromstage
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's Event.REMOVED_FROM_STAGE occurs for this object.
onresize
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's Event.RESIZE occurs for this object, i.e. when its size changes.
onrollout
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's MouseEvent.ROLL_OUT occurs for this object.
onrollover
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's MouseEvent.ROLL_OVER occurs for this object.
onvisible
- Type: Script
- Version: 2.0.11
Event attribute. The contained script is evaluated when Flash's VisibilityEvent.VISIBLE occurs for this object, i.e. when its visibility property changes to true.
| ASUL-related articles | |
|---|---|
| Components | Box · Button · ProgressBar · ScrollBar · ScrollPane · Text · ToggleButton · Window |
| Layouts | Horizontal Flow Layout · Vertical Flow Layout |
| ASUL Articles | ASUL Document · Editing the GUI · Layouting · ASUL scripting |