Image
Check out the standard help for an overview of the image component.
API Examples
// Internally the component is known as "image"
var imageComponent1 = findComponent("My Page", "image", "MyImage"); // To retrieve a image component called "MyImage" on a page called "My Page"
var imageComponent2 = findComponentInForeground("My Foreground", "image", "MyImage"); // To retrieve a image component in the foreground.
var imageComponent3 = createComponent(parentComponent, "image", 0, 0, 100, 100); // to create a image component inside a custom component.
// Retrieving a property
var image = getProperty(imageComponent1, "filename");
console.log(image);
// Setting a property
setProperty(imageComponent1, "crop_mode", 1);
// Binding an event
bindEvent(imageComponent3, "on_press", "action");
function action(){
console.log("hello world");
}
Properties
See the shared property list for all properties available for this component.
| Property | Type | Description |
|---|---|---|
| filename | string | The filename of image |
| crop_mode | number | 0 – crop 1 – fit 2 – stretch |
| align_x | real | Default is 0.5 |
| align_y | real | Default is 0.5 |
| effect_name | string | |
| mask_filename | string | The filename of mask |
| native_width | string | Read Only. The original width of image |
| native_height | string | Read Only. The original height of image |
Events
See the shared event list for all events available for this component.