The frame tag is used within the resource tag to define a single frame of a multiframe resource. The attributes of the frame tag are presented in Table 2.17.
Name | Usage | Type | Default | Accessibility |
---|---|---|---|---|
name | Tag only | string | final | |
Description. An identifier for this frame. | ||||
src | Tag only | string | final | |
Description. The URL to an external file to be associated with this frame. |
The LZX application in Listing 2.15 shows how to use the resource tag with two frames.
<canvas> <resource name="arrow"> <frame src="arrow1.gif"/> <frame src="arrow2.gif"/> </resource> <view resource="arrow" onmousedown="setResourceNumber(2)" onmouseup="setResourceNumber(1)" /> </canvas> |
The view tag in Listing 2.15 is linked to the resource tag named arrow. The setResourceNumber method accepts an index number and assigns the frame at the specified index to the view. As a result, when you click the view, the second frame will be used. When you release the mouse, the first frame is used.
To test the application, direct your browser to this URL:
http://localhost:8080/lps-4.0.x/app02/frameTest1.lzx
The result is shown in Figure 2.20.