Simple Actions

Hello World 1

All this action does is display a ‘hello world’ message when it’s called. It doesn’t have any parameters the user can specify.

Hello World 2

This will take two parameters and do some transformation on them, then display them. The first parameter is a string labeled caption with a default value of ‘default’. The second parameter is an integer labeled value and a default of 10 and shown on a number-line from 0 minimum to 100 maximum. If the defaults are used, when the action is called the console will show ‘caption = default AND value * 10 = 100’

Note the types of parameters you can pass to the registerAction are;

  • bool:label[:default_value] – the label describes the parameter for the user. Examples: “bool:Expand” or “bool:With particles:yes”. default_value can be: true, false, on, off, yes, no
  • string:label[:default_value] – the label describes the parameter for the user
  • int:label[:default_value]:min:max – after the label, the default, min and max numeric values
  • real:label[:default_value]:min:max – after the label, the default, min and max real values
  • component:label:type – after the label the type of component.

Hello World 3

This will parameters including a component, then update a property on the component. We will make some code that will change the text on a button and make it bounce!

Currency Converter

This example shows how to call a JavaScript action which requires the designer to specify some components as parameters, and then calling a asynchronous webservice. When the webservice returns with the result the data can be extracted from the CSV and then the components can be updated with the resulting calculation.

currency

World Clock Example

This action allows you to make any text component a digital world clock. You can specify the offset from UTC which you can find on wikipedia.