-
Notifications
You must be signed in to change notification settings - Fork 8
Protocol
All messages passed back and forth between the Flash virtual machine and the external language are in XML. There are 5 different commands documented below.
All the commands work with object references and values. Values passed back and forth are contained within a single XML element. Values can be represented in two ways:
-
Primitives (String, int, float, boolean & null) are copied and sent in a message. These values have a
value
attribute equal to their literal representation and adataType
attribute equal signifying their type. -
Objects are sent by reference. These XML element elements are represented with a
value
attribute set to the object's proxy identifier and thedataType
attribute is set to "object".
Proxy identifiers are used by the external language to reference objects that have already been accessed. These identifiers are also used in some commands (Get Property, Set Property, & Invoke Method) to reference the object which has the property or method being used.
This command creates an object given a fully qualified class name. The format for this command is:
<create class="flash.geom.Point"/>
This will create a Point
object and return a reference to the object. The
Create Object command is limited in that it can only instantiate objects from
zero-argument constructors.
This command returns a reference to a class given a fully qualified class name. The format for this command is:
<get-class name="flash.display.Stage"/>
This command is useful when a reference is needed to a class in order to read static methods or properties.
This command returns the value of a property on an object. Because classes are objects in ActionScript, this works on classes as well. The format for this command is:
<get object="123" property="name"/>
This command can return a primitive value or a reference to an object.
This command sets a property on an object to a given value. The format for this command is:
<set object="123" property="name">
<arg value="bar" dataType="string"/>
</set>
This command will return the value of the property that is being set so that it can be chained in the external language.
This command invokes a method on an object and passes zero or more arguments. The format for this command is:
<invoke object="123" property="concatenate">
<args>
<arg value="foo" dataType="string"/>
<arg value="bar" dataType="string"/>
</args>
</set>
This example method invocation would return this message:
<return value="foobar" dataType="string"/>
This command invokes a package level function and passes zero or more arguments. The format of this command is:
<invoke-function name="flash.utils.getQualifiedClassName">
<args>
<arg value="foo" dataType="string"/>
</args>
</set>
This example method invocation would return this message:
<return value="String" dataType="string"/>
All return values are represented with a value element in the following format:
<return value="foo" dataType="string"/>