The <frame>
tag is used to define a single frame
of a multi-frame <resource>
. A multi-frame resource
contains several images which can be toggled among by script commands.
For example:
<resource name="mfr"> <frame src="f1.jpg"/> <frame src="f2.jpg"/> </resource>
Multiple frame tags can be declared consecutively to produce a single
resource constructed of an unlimited number of frames. Such composed
resources are often used to conveniently implement mouse rollovers,
button states, or other UI elements where alternate views of a
resource are required. Once a multi-frame resource has been defined
and presented within a <view>
, the developer
can designate which frame is actively visible through the use of the
view's setResourceNumber
method.
Multi-frame resources can be used in conjunction with components
such as <basebutton>
, which pre-define complex
button behavior using frames designated by the user.
The following example manually implements a simple button with mouse rollover and down state behavior:
<canvas
height
="120
">
<!-- create the multi-frame resource and give it a name -->
<resource
name
="mybutton_rsrc
">
<!-- first frame is the mouseup state of the button -->
<frame
src
="../images/basebutton/button-up.png
"/>
<!-- second frame is the mouseover state of the button -->
<frame
src
="../images/basebutton/button-over.png
"/>
<!-- third frame is the mousedown state of the button -->
<frame
src
="../images/basebutton/button-down.png
"/>
</resource
>
<!-- include the resource in a view with mouse behaviors -->
<view
resource
="mybutton_rsrc
" onmouseover
="setResourceNumber(2)
" onmouseout
="setResourceNumber(1)
" onmousedown
="setResourceNumber(3)
" onmouseup
="setResourceNumber(2)
"/>
</canvas
>
Name (CSS property) | Type (tag) | Type (js) | Default | Category |
---|---|---|---|---|
name
|
token | initialize-only | ||
The name of a variable that will be set to this object when the application is started. If this element is directly within
a <canvas> or <library> element, the global variable and the canvas property with this name will be set to this object. If this element is within
another object, that object's property with this name will be set to this object.
|
||||
src
|
URL | initialize-only | ||
The path of a file that contains the source for this object. |
Copyright © 2002-2010 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.