org.silex.core.Interpreter

This class is used to execute SILEX commands.  It is a singleton pattern.

Summary
org.silex.core.InterpreterThis class is used to execute SILEX commands.
Variables
silex_ptrReference to silex main Api object (org.silex.core.Api).
Functions
InterpreterConstructor.
execCall the method corresponding to the desired command.
updateSourceFind a movie clip corresponding to a path relatively to a source clip.
buildActionArrayFromStringTakes series of commands separated by ‘\n’, i.e a line break.
extractSeparates name of function from the params.
modify_valCheck if a number has to be incremented or decremented.
openUrlOpen a URL.
httpOpen a URL
mailtoOpen a programm to write an email to the specified adress.
downloadOpen the browser download dialog box.
javascriptExecute a javascript command.
setSet a variable value
delDelete a variable.
showShow a clip or a player.
hide@param targetObjectPath_str path to the object which contains the property to modify @example hide:aaa @example aaa.hide
traceTrace, i.e.
alertOutput something in a message box.
alertSimpleOutput something at the bottom of the screen.
send_textSends a component’s html text to a script (for printing or send by mail).
PRINTOpen the browser print dialog.
logLogs a message on the server - use cgi/scripts/log_command.php.
openWebsiteclose current website and open an other website on the same server
openOpen an internal link.
closeClose the layout opened by calling mc.
tag_configConfigures the tag system to prepare tag command calls.
tagCall the cyberestat tag system (of mediametrie estat).
flattenConvert an array or elements of an array or object to a string.
serviceCallCall a webservice and returns the result The result is placed in <<silex.lastResult>> - either fault object (use lastResult.faultstring) or service call result and the specified success or error event is thrown
getLatestSilexVersioncall the service to retrieve silex latest version number the player which is the source of the call will dispatch an onLatestSilexVersion event
open@param extract_array[1]=xml file name without extention, @param extract_array[2]=[optional] “none” or layout url or child layout number, @param extract_array[3]= [optional] Object in which to open the section (self,parent,child), @example ouvrir:test,none,child @example open:test,none,child,fiches_
open_icone@param extract_array[1]= [optional] icone number (default = 1), @param extract_array[2]= [optional] layout level (default = self), 1st layout is number 1, valid values : [1,100] @example open_icone:1 @example open_icone:1,3
back@param extract_array[1]= (+/-)number of times to come back @param extract_array[2]= [optional] dbdata (or none)/no_dbdata => do not pass current dbdata_obj to the new page (default=none=pass the dbdata) @example back:-5 @example back:0

Variables

silex_ptr

private var silex_ptr: org.silex.core.Api

Reference to silex main Api object (org.silex.core.Api).

Functions

Interpreter

function Interpreter(api: org.silex.core.Api)

Constructor.

Parameters

param api reference to silex main Api object (org.silex.core.Api)

exec

function exec(command_str: String,
initialSource_mc: Object):Boolean

Call the method corresponding to the desired command.

Parameters

command_stra source, method and parameters like relative.path.to.source.method:param1,param2,...
initialSource_mcmovie from which comes the command (source is relative to this parameter)

Returns

true if no error occured

updateSource

private function updateSource (source_mc: Object,
path_str: String):Object

Find a movie clip corresponding to a path relatively to a source clip.  @private

Parameters

param source_mc source clip
param path_str path relative to the source clip

Returns

movie clip corresponding to a path relatively to a source clip

buildActionArrayFromString

function buildActionArrayFromString(_str: String):Array

Takes series of commands separated by ‘\n’, i.e a line break.  Returns an array of objects which are a model of the commands.  Used by ui.players.Abstract.  Used by toolbox.Actions.  Here, specifier means “onRelease” in the command “onRelease myCommand:myParam1,myParam2”.  @example buildActionArrayFromString(“onRelease alert:test of alert\nonRollOut nameOfPlayer.hide:”) will return [{modifier:”onRelease”, functionName:”alert”, parameters:array(“test of alert”)},{modifier:”onRollOut”, functionName:”hide”, parameters:array(“nameOfPlayer”)}]

Parameters

param _str commands separated by ‘\n’, i.e a line break

Returns

an array of objects which are a model of the commands

extract

function extract(command_str: String):Array

Separates name of function from the params.

Parameters

param command_str a command

Returns

array of strings where first element is the command name and the other ones are the arguments of the command

modify_val

function modify_val(arg_var_num: Number,
val_str: String):Number

Check if a number has to be incremented or decremented.

Parameters

param arg_var_num the input number
param val_str the modifier

Returns

the resulting number

openUrl

function openUrl(url_str: String,
target_str: String)

Open a URL.

Parameters

url_strthe url to be opened
target_str[optional] targeted window (“_blank”,”_self”,...)

http

function http(url_str: String,
target_str: String)

Open a URL

Parameters

url_strurl beginning with ‘//’ since because the command is http:+arguments
target_str[optional] targeted window (“_blank”,”_self”,...)

mailto

function mailto(adress_str: String)

Open a programm to write an email to the specified adress.

Parameters

param adress_str mail adress

download

function download(initialFileName_str: String,
finalFileName_str: String)

Open the browser download dialog box.

Parameters

param initialFileName_str initial file name
param finalFileName_str [optional] final file name

javascript

function javascript()

Execute a javascript command.

Parameters

param parameters javascript instructions

set

function set(propertyName_str: String,
value_str )

Set a variable value

Parameters

propertyName_strname of the property to modify - this can be a path
value_strboolean, number or string - value for the property (number may use +/- for relative or exact value)

del

function del(propertyName_str: String)

Delete a variable.

Parameters

propertyName_strname of the property to modify

show

function show(targetObjectPath_str: String)

Show a clip or a player.

Parameters

targetObjectPath_strpath to the object which contains the property to modify

hide

function hide(targetObjectPath_str: String)

@param targetObjectPath_str path to the object which contains the property to modify @example hide:aaa @example aaa.hide

trace

function trace()

Trace, i.e. outputs, something in the debug console.

Parameters

parameterstext to trace

alert

function alert()

Output something in a message box.

Parameters

parameterstext to alert

alertSimple

function alertSimple()

Output something at the bottom of the screen.

Parameters

parameterstext to alert

send_text

function send_text(scriptUrl_str: String,
target_str: String,
isHtml_str: String,
params_str: String,
usePostMethod_str: String)

Sends a component’s html text to a script (for printing or send by mail).

Parameters

scriptUrl_strscript url
target_str[optional] target window : _blank (default), _self, or a frame id
isHtml_str[optional] boolean: true (default) or false (= raw text only)
params_str[optional] parameters to pass to the script (url style)
usePostMethod_str[optional] method used to send data: true => POST (default) or false => GET

PRINT

function PRINT(textField,
useHtml,
useBgColor)

Open the browser print dialog.  !!!  Works only with one page long text...  For several pages use : onRelease Text1.send_text:cgi/scripts/print.php.  Print the content of a text field.

Parameters

textFieldtext field name
useHtml[optional] keep formatting - default = true
useBgColor[optional] print on bg color - default = true

log

function log(logFileName_str: String,
message_str: String)

Logs a message on the server - use cgi/scripts/log_command.php.

Parameters

logFileName_strlof file’s name
message_strmessage to be logged

openWebsite

function openWebsite(id_site: String)

close current website and open an other website on the same server

open

function open(sectionName_str: String)

Open an internal link.

Parameters

sectionName_strsection name

close

function close()

Close the layout opened by calling mc.  @example monclip.close

tag_config

function tag_config(serial_str: String,
class_str: String)

Configures the tag system to prepare tag command calls.  Used for cyberestat statistics logs.

Parameters

serial_strserial (client id) - number
class_strclass (website id) - string

tag

function tag(pageName_str: String)

Call the cyberestat tag system (of mediametrie estat).

Parameters

pageName_strpage name

flatten

function flatten(separator: String,
subElementName: String):String

Convert an array or elements of an array or object to a string.

Parameters

param separator what to put between elements. ex: “,”
param subElementName [optional] path to the sub-element in each array element.  The function works a like Array.join if this parameter is not given

serviceCall

function serviceCall(serviceName_str: String,
successEvent: String,
errorEvent: String)

Call a webservice and returns the result The result is placed in <<silex.lastResult>> - either fault object (use lastResult.faultstring) or service call result and the specified success or error event is thrown

Parameters

param serviceName_str
param successEvent event thrown after a successfull call
param errorEvent event thrown on an error
param other params passed to the webservice

getLatestSilexVersion

public function getLatestSilexVersion()

call the service to retrieve silex latest version number the player which is the source of the call will dispatch an onLatestSilexVersion event

open

@param extract_array[1]=xml file name without extention, @param extract_array[2]=[optional] “none” or layout url or child layout number, @param extract_array[3]= [optional] Object in which to open the section (self,parent,child), @example ouvrir:test,none,child @example open:test,none,child,fiches_

open_icone

@param extract_array[1]= [optional] icone number (default = 1), @param extract_array[2]= [optional] layout level (default = self), 1st layout is number 1, valid values : [1,100] @example open_icone:1 @example open_icone:1,3

back

@param extract_array[1]= (+/-)number of times to come back @param extract_array[2]= [optional] dbdata (or none)/no_dbdata => do not pass current dbdata_obj to the new page (default=none=pass the dbdata) @example back:-5 @example back:0

private var silex_ptr: org.silex.core.Api
Reference to silex main Api object (org.silex.core.Api).
function Interpreter(api: org.silex.core.Api)
Constructor.
function exec(command_str: String,
initialSource_mc: Object):Boolean
Call the method corresponding to the desired command.
private function updateSource (source_mc: Object,
path_str: String):Object
Find a movie clip corresponding to a path relatively to a source clip.
function buildActionArrayFromString(_str: String):Array
Takes series of commands separated by ‘\n’, i.e a line break.
function extract(command_str: String):Array
Separates name of function from the params.
function modify_val(arg_var_num: Number,
val_str: String):Number
Check if a number has to be incremented or decremented.
function openUrl(url_str: String,
target_str: String)
Open a URL.
function http(url_str: String,
target_str: String)
Open a URL
function mailto(adress_str: String)
Open a programm to write an email to the specified adress.
function download(initialFileName_str: String,
finalFileName_str: String)
Open the browser download dialog box.
function javascript()
Execute a javascript command.
function set(propertyName_str: String,
value_str )
Set a variable value
function del(propertyName_str: String)
Delete a variable.
function show(targetObjectPath_str: String)
Show a clip or a player.
function hide(targetObjectPath_str: String)
@param targetObjectPath_str path to the object which contains the property to modify @example hide:aaa @example aaa.hide
function trace()
Trace, i.e.
function alert()
Output something in a message box.
function alertSimple()
Output something at the bottom of the screen.
function send_text(scriptUrl_str: String,
target_str: String,
isHtml_str: String,
params_str: String,
usePostMethod_str: String)
Sends a component’s html text to a script (for printing or send by mail).
function PRINT(textField,
useHtml,
useBgColor)
Open the browser print dialog.
function log(logFileName_str: String,
message_str: String)
Logs a message on the server - use cgi/scripts/log_command.php.
function openWebsite(id_site: String)
close current website and open an other website on the same server
function open(sectionName_str: String)
Open an internal link.
function close()
Close the layout opened by calling mc.
function tag_config(serial_str: String,
class_str: String)
Configures the tag system to prepare tag command calls.
function tag(pageName_str: String)
Call the cyberestat tag system (of mediametrie estat).
function flatten(separator: String,
subElementName: String):String
Convert an array or elements of an array or object to a string.
function serviceCall(serviceName_str: String,
successEvent: String,
errorEvent: String)
Call a webservice and returns the result The result is placed in <<silex.lastResult>> - either fault object (use lastResult.faultstring) or service call result and the specified success or error event is thrown
public function getLatestSilexVersion()
call the service to retrieve silex latest version number the player which is the source of the call will dispatch an onLatestSilexVersion event