Appxweb Meta
Home > Developer > Developer Guide - Contents

Developer Guide

[ 5 ] - Scripting

< Back   Next >

Within a Meta extension scripts are able to be executed within:

Futhermore any ActiveScript compatible Scripting language can be used.

Meta provides scripting objects for working with data, view and function objects for both types of script hosts. The names of these scripting objects are "AM_data", "AM_view" and "AM_function". The Scripting reference documentation contains details of the properties and methods of these scripting objects

As an example the AML declaration for the script function object "fid_letter_cnt", used by the Hello World is shown below with the scripting objects "AM_data" and "AM_view" highlighted. The "AM_data" scripting object is used to modify the data object "did_message" with the "AM_view" object used to present a message dialog.

Figure: Script Function Object fid_letter_cnt - Use of Data and View Scripting Objects Highlighted
Scripting within a script function object

As another example the HTML resource "wnd_hello_wnd.html" is shown below with the scripting objects used within the "lowercase" script function highlighted. The "AM_data" scripting object is again used to work with "did_message" data object changing the value held to lowercase. Next the "Run" method of function scripting object is used to execute the canned function object "_fid_data_set". This forces an update of the <span> element which is bound to the "did_message" data object.

Figure: HTML Script  lowercase() - Use of Data and Function Scripting Objects Highlighted
Scripting within a HTML resource

Note that the "lowercase" script function shown above is not called directly from within the HTML resource itself. Instead a "call_script" function object having an identifier of "fid_lowercase" is used. This object is referenced by the "lowercase" menu item of the "vid_menu_format" menu view object. Clicking this menu item causes the "fid_lowercase" call_script function object to execute which in turn calls the "lowercase" script to Run within the HTML resource. The sequence is shown below.

Figure: fid_lowercase, fid_lowercase_call_script and HTML script lowercase() Execution Sequence
Using the "call_script" function object