<resource>

A tag that defines a media object that can be associated with a view.

This tag defines a media object, that can be presented within a view. A media object is an image, movie, animation, or sound clip. This tag imports the object into the application, and binds it to a string which can be used within a view. For example:

<canvas height="70">
  <resource name="logo" src="images/logo.png"/>
  <view resource="logo"/>
</canvas>

The src attribute refers to the filename of any valid resource type, including an optional directory path relative to the directory of the declaration. Valid resource types for images and animations include: .SWF, .PNG, .JPG, and .GIF; valid audio types include: .MP3.

Audio resources must be MP3 files at one of the following sample rates: 11.025 khz, 22.5 khz, and 44.1 khz, and encoded at no more than 160kbps.

The dataimage example further demonstrates the use of the resource tag.

For details on multi-frame resources, see frame.

Attributes
Name Usage Type (Tag) Type (JS) Default Category
name Tag only token   final
 

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 Tag only URL   final
 

The path of a file that contains the source for this object.