Resource

出自OpenFace

跳转到: 导航, 搜索

<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, animation. 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: , .PNG, .JPG, and .GIF.

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.