• References
    • Main
    • RenderKit
    • LibJS
    • Canvas
  • Components
    • Overview
    • Page
    • Basic
      • Rectangle
      • Text
      • Button
      • HTML Article
      • Toggle Button
      • Tiler
      • Web View
      • Image Zoomer
    • Navigation
      • Carousel
    • Forms
      • Form
      • Text Entry
    • Layout
      • Group
  • Web API
  • Tutorials
  • Contact
Menu
  • References
    • Main
    • RenderKit
    • LibJS
    • Canvas
  • Components
    • Overview
    • Page
    • Basic
      • Rectangle
      • Text
      • Button
      • HTML Article
      • Toggle Button
      • Tiler
      • Web View
      • Image Zoomer
    • Navigation
      • Carousel
    • Forms
      • Form
      • Text Entry
    • Layout
      • Group
  • Web API
  • Tutorials
  • Contact
Umajin Developer > Components

Components

The following properties can be used in any component.

API Examples

// 1. In Editor, "File" - "Open with Visual Studio Code" to open VS Code
// 2. Create a js file
// 3. Copy and Paste the code to the js file, save the js file.
// 4. Back to Editor, Add a button to a page
// 5. Assigh "test_origin" to the button.
// 6. Play.

registerAction("test_origin", "", "test_origin", "");
function test_origin() {
  // get properties
  var x = getProperty(self, "x");
  var y = getProperty(self, "y");
  var w = getProperty(self, "width");
  var h = getProperty(self, "height");
  print("before x", x);
  print("before y", y);

  if (typeof firstTime == "undefined") {
    firstTime = true;
  } else {
    firstTime = false;
  }

  // only set one time
  if (firstTime) {
    // set the origin
    var factor = 0.5;
    setProperty(self, "origin_x", factor); // range (0 - 1) 1 means the width of the component
    setProperty(self, "origin_y", factor); // range (0 - 1) 1 means the height of the component
    print("origin  x", getProperty(self, "origin_x")); // return value is in pixels
    print("origin  y", getProperty(self, "origin_y")); // return value is in pixels

    // get origin in decimal
    var origin_x = getProperty(self, "origin_x") / w;
    var origin_y = getProperty(self, "origin_y") / h;

    // set back the position of the component
    setProperty(self, "x", x + origin_x * w);
    setProperty(self, "y", y + origin_y * h);
    print("after  x", getProperty(self, "x"));
    print("after  y", getProperty(self, "y"));
  }

  // animation
  setPropertyIn(self, "angle", 36000, 1000);
  setPropertyIn(self, "angle", 0, 1010);
}

Properties

PropertyTypeDescription
form_enabledboolA Boolean value that indicates whether the value of the component will be submitted along with the form
passed_form_validationboolA Boolean value that indicates whether the component has passed the form validation
form_field_namestringThe name will be saved when the form is submitted
alphanumberSet the alpha level for a component
visibleboolA Boolean value that indicates whether the component is visible
hiddenboolA Boolean value that indicates whether the component is hidden
lock_widthboolWhen true, the width of the component will be use millimeter positioning
lock_heightboolWhen true, the height of the component will be use millimeter positioning
lock_width_sizenumberSet the width of a component in millimeters
lock_height_sizenumberSet the height of a component in millimeters
lock_leftboolWhen true, the left of the component will be use millimeter positioning
lock_rightboolWhen true, the right of the component will be use millimeter positioning
lock_topboolWhen true, the top of the component will be use millimeter positioning
lock_bottomboolWhen true, the bottom of the component will be use millimeter positioning
lock_left_sizenumberSet the left of a component in millimeters
lock_right_sizenumberSet the right of a component in millimeters
lock_top_sizenumberSet the top of a component in millimeters
lock_bottom_sizenumberSet the bottom of a component in millimeters
unique_idstringRead Only. A unique Id for components
instance_display_namestringRead Only. The name of the component in the Umajin Editor
typestringRead Only. Specifies the type of the component. e.g. Button, text
parentstringRead Only. Specifies the “unique_id” of the parent component. e.g. 0000025209C39AA0
xnumberThe x-coordinate of the top-left of the component in pixels
ynumberThe y-coordinate of the top-left of the component in pixels
widthnumberSpecifies how wide a component is in pixels
heightnumberSpecifies how height a component is in pixels
opacitystringSet the opacity level for a component
anglenumberThe angle, in degrees
scalenumberDefault is 1. Scale factor
scale_widthnumberDefault is 1. Scale factor on the x-coordinate, the anchor point is (0, 0)
scale_heightnumberDefault is 1. Scale factor on the y-coordinate, the anchor point is (0, 0)
origin_xfloat (0 – 1)Refer to the API Example
origin_yfloat (0 – 1)Refer to the API Example
maskstringAn optional layer whose alpha channel is used to mask the component’s content

Events

These can be used with bindEvent or raiseEvent.

EventParamsDescription
on_down  (x, y, touchIndex)Occurs when a user touches down on the component.
on_up  (x, y, touchIndex)Occurs when a user lifts up on the component. It can be occur outside of the component.
on_press  (x, y, touchIndex)A up event is called before “on_up”. Only will be called when the finger is inside the bounds of the component
on_move  (x, y, touchIndex)This event will be raised when a user moves while maintaining a down state.  e.g. if the user drags right by 100 pixels it will fire off several on_move events.
  • Developer Home
  • Umajin Home
  • Support Home
Menu
  • Developer Home
  • Umajin Home
  • Support Home