The external API’s XML format

Communication between ActionScript and an application hosting the Shockwave Flash ActiveX control uses a specific XML format to encode function calls and values. There are two parts to the XML format used by the external API. One format is used to represent function calls. Another format is used to represent individual values; this format is used for parameters in functions as well as function return values. The XML format for function calls is used for calls to and from ActionScript. For a function call from ActionScript, Flash Player passes the XML to the container; for a call from the container, Flash Player expects the container application to pass it an XML string in this format. The following XML fragment shows an example XML-formatted function call:

<invoke name="functionName" returntype="xml"> 
        ... (individual argument values) 

The root node is the invoke node. It has two attributes: name indicates the name of the function to call, and returntype is always xml. If the function call includes parameters, the invoke node has a child arguments node, whose child nodes will be the parameter values formatted using the individual value format explained next.

Individual values, including function parameters and function return values, use a formatting scheme that includes data type information in addition to the actual values. The following table lists ActionScript classes and the XML format used to encode values of that data type:

ActionScript class/value

C# class/value







Boolean true

bool true



Boolean false

bool false





<string>string value</string>


Number, int, uint

single, double, int, uint


Array (elements can be mixed types)

A collection that allows mixed-type elements, such as ArrayList or object[]

    <property id="0"> 
    <property id="1"> 
        <string>Hello there!</string> 

The property node defines individual elements, and the id attribute is the numeric, zero-based index.


A dictionary with string keys and object values, such as a HashTable with string keys

    <property id="name"> 
        <string>John Doe</string> 
    <property id="age"> 

The property node defines individual properties, and the id attribute is the property name (a string).

Other built-in or custom classes

<null/> or  

ActionScript encodes other objects as null or as an empty object. In either case any property values are lost.

Note: By way of example, this table shows equivalent C# classes in addition to ActionScript classes; however, the external API can be used to communicate with any programming language or run time that supports ActiveX controls, and is not limited to C# applications.

When you are building your own applications using the external API with an ActiveX container application, you’ll probably find it convenient to write a proxy that will perform the task of converting native function calls to the serialized XML format. For an example of a proxy class written in C#, see Inside the ExternalInterfaceProxy class.