Skip to main content
Skip table of contents

Basics of the Action Script Language

The Action Script language comes with a syntax scheme as explained below. Also, the reserved keywords of the Action Script language cannot be used as variable names.

When writing action scripts, you should respect the following explanations regarding

Syntax Scheme

The following syntax scheme applies to the action script language.

Names

All object and attribute names in Action Scripts must follow the syntax below:

[a-zA-Z]([a-zA-Z0-9])*

However, UML names are not restricted and may contain any character. To use these names in Action Scripts apply backticks as follows:

If the name of an element contains other characters, it must be escaped by backticks as follows:

`invalid name`

Consequently, the only characters not allowed in element names that are to be used in action scripts are backticks (`).

If the invalid attribute name is given by an external representation, e.g. it has to be serialized into an XML document, flat file, IDocs or such, you can also use the attribute externalName on attributes to hold the external name.
This way, you can use a valid name internally. Once the data is serialized, the external name will be used.

Examples

Some escaping examples:

Element

Name

Usage With Escaping

Class attribute

strange name having blanks and dots: ...

object.`strange name having blanks and dots: ...`;

Class attribute

a-b

object.`a-b`;

Operation

::my strange operation name::

object.`::my strange operation name::`();

Parameter

äparam

set `äparam` = "test";

Object

a//b

create `a//b`;

17_name

create `17_name`;

Case Sensitivity

All operations, statements, variable names, class names, and attribute names are case sensitive.

Examples

  • The variables myVar and myvar are two different variables.

  • The xUML Compiler will not recognize an assignment statement Set. You need to write set in lowercase instead.

Scripting Style

Operations can be scripted in an object-oriented or a procedural syntax style. The differences are shown in the example table on the right.

Examples

Object-oriented Style

Procedural Style

myVariable.exists();

exists(myVariable);

myDataItem.myAttr.exists();

exists(myDataItem.myAttr);

s.substring(0, 5);

substring(s, 0, 5);

set aString = s.substring(0, 5).toUpper();

set aString = toUpper(substring(s, 0, 5));

Object Navigation

Use the following syntax to navigate to properties and operations within an object:

Target

Syntax

Example

Property

objectName.propertyName

product.category

Operation

objectName.operationName(parameters)

product.new()

Sub-property of a complex property

objectName.propertyName.subPropertyName

product.storage.area

Array property

objectName.arrayProperty

product.versions

Array property element

objectName.arrayProperty[index]

product.versions[3]

Reserved Keywords

The following keywords, constants, operators etc. should not be used as variable names as they are reserved for action script execution:

  • and

  • append

  • apply

  • array

  • by

  • catch

  • create

  • distinct

  • each

  • else

  • errorCode

  • errorType

  • false

  • first

  • from

  • group

  • if

  • last

  • like

  • local

  • NULL

  • or

  • reduce

  • select

  • set

  • single

  • sort

  • then

  • to

  • true

  • unlike

  • use

  • using

  • where

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.