Made to Order Software Corporation Logo

data

Push Data

SWF Action
Action Category: 
Stack
Action Details: 
0
Action Identifier: 
150
Action Structure: 
struct {
	unsigned char   f_type
	<type>          f_data
} f_push_data[<variable>];
Action Length: 
-1 byte(s)
Action Stack: 
push <variable> (a)
Action Operation: 
a1 = f_data[0];1
push(a1);
a2 = f_data[1];
push(a2);
a3 = f_data[2];
push(a3);
...
an = f_data[n];
push(an);
  • 1. Notice that the first data in the action is the last accessible on your stack.
Action Flash Version: 
4
See Also: 

Push some immediate data on the stack. This action was introduced in V4.0. The supported data types vary depending on the version of the player you have. As many values as necessary can be pushed at once. The f_push_data structure will be repeated multiple times as required. For instance, to push two strings on the stack at once, you would use the following code:

Implements

SWF Action
Action Category: 
Objects
Action Details: 
0
Action Identifier: 
44
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 1 (o), pop 1 (i), pop i2 (o)
Action Operation: 
o1 := pop();
i2 := pop();
for (idx := 3; idx <= i2 + 2; ++idx) {
  oidx := pop();
}
o1 implements o3, o4, o5, ... , o(i2 +2)
Action Flash Version: 
7

This action declares an object as a sub-class of one or more interfaces. The syntax here is simple, the real implementation is quite unbelievably difficult to fathom.

The following shows you how you can add an implements of interfaces "A" and "B" to the class "C". Notice that class "C" needs to already exist. Here we assume that all classes are defined in the global scope.

	push data "_global"
	get variable
	push data "A"
	get member
	push data "_global"
	get variable
	push data "B"
	get ...

Sprite Properties

The following is the list of currently accepted properties or fields for the Get Property and the Set Property actions. Note that the properties can be specified with either an integer (type 7, requires V5.0+) or a single precision floating point (type 1, V4.0 compatible). And since strings are automatically transformed in a value when required, one can use a string to represent the property number (type 0).

SWF Internal Functions

Since Flash version 5, you can use internal functions (really member functions or methods of internal objects.) These functions are always available. These methods are called using the Call Function action with the name of the object and function separated by a period. A few of these internal functions are duplicates of some direct action script instructions. In general, it is preferred to use these internal functions rather than the direct action. However, direct actions are a good way to optimize your ActionScript code.

Similarly, you can access internal constants (really variable ...

Duplicate

SWF Action
Action Category: 
Stack
Action Details: 
0
Action Identifier: 
76
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 1 (a), push 2 (a)
Action Operation: 
a1 := pop();
push(a1);
push(a1);
Action Flash Version: 
5
See Also: 

Pop one item and push it back twice.

Note that it is a very good idea to use this action instead of duplicating data in a Push Data.

Delete

SWF Action
Action Category: 
Variables
Action Details: 
0
Action Identifier: 
58
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 1 (s), pop 2 (o), push 1 (b)
Action Operation: 
s1 := pop();
o2 := pop();  // undefined or _root or _global for global variables
r := delete(s1, o2);
push(r);
Action Flash Version: 
5

Pop one string representing the name of the property to be deleted. Then pop the object from which the property is to be deleted.

In version 5 through 8, it is necessary to Push Data type undefined (0x03)1 before the string as in:

96 04 00 03 00 'a' 00 3A
delete("a");

to delete a global variable.

  • 1. Since player version 9, deleting a dynamic (global) variable requires _root (or _global) instead of undefined.

Declare Function (V7)

SWF Action
Action Category: 
Control
Action Details: 
(256 variables)
Action Identifier: 
142
Action Structure: 
string     f_name;
unsigned short   f_arg_count;
unsigned char   f_reg_count;
unsigned short   f_declare_function2_reserved : 7;
unsigned short   f_preload_global : 1;
unsigned short   f_preload_parent : 1;
unsigned short   f_preload_root : 1;
unsigned short   f_suppress_super : 1;
unsigned short   f_preload_super : 1;
unsigned short   f_suppress_arguments : 1;
unsigned short   f_preload_arguments : 1;
unsigned short   f_suppress_this : 1;
unsigned short   f_preload_this : 1;
swf_params   f_params[f_arg_count];
unsigned short   f_function_length;

WARNING: the preload/suppress flags are defined on a short and thus the bytes in a Flash file will look swapped.

Action Length: 
-1 byte(s)
Action Stack: 
n.a.
Action Operation: 
create a function on the current target
Action Flash Version: 
7

Declare a function which can later be called with the Call Function action or Call Method action (when defined as a function member.) The f_function_length1 defines the number of bytes that the function declaration uses after the header (i.e. the size of the actions defined in the function.) All the actions included in this block are part of the function body.

  • 1. A function is limited to 65535 bytes.

Declare Function

SWF Action
Action Category: 
Control
Action Details: 
0
Action Identifier: 
155
Action Structure: 
string    f_name;
unsigned short   f_arg_count;
string   f_arg_name[f_arg_count];
unsigned short   f_function_length;
Action Length: 
-1 byte(s)
Action Stack: 
n.a.
Action Operation: 
create function f_name in the current target movie
Action Flash Version: 
5

Declare a function which later can be called with the Call Function action. The f_function_length1 defines the number of bytes that the function declaration takes. All the actions included in this block are part of the function. A function should terminate with a Return action. The value used by the return statement should be the only value left on the caller stack.

  • 1. Functions are limited to 65535 bytes in length.

Declare Dictionary

SWF Action
Action Category: 
Objects
Action Details: 
0
Action Identifier: 
136
Action Structure: 
unsigned short    f_count;
string   f_dictionary[f_count];
Action Length: 
-1 byte(s)
Action Stack: 
n.a.
Action Operation: 
<n.a.>
Action Flash Version: 
5
See Also: 

Declare an array of strings that will later be retrieved using the Push Data action with a dictionary lookup. There can be a maximum of 65534 strings. The visibility of a dictionary is within its DoAction or other similar block of actions. Note that you should have only one Declare Dictionary. The dictionary is visible from everywhere in the DoAction. In other words, you can access it from functions1, With blocks, try/catch/finally blocks, etc.

When multiple Declare Dictionary actions are used, ...

Branch If True

SWF Action
Action Category: 
Control
Action Details: 
0
Action Identifier: 
157
Action Structure: 
signed short   f_offset;
Action Length: 
2 byte(s)
Action Stack: 
pop 1 (b)
Action Operation: 
b1 := pop();
if(b1) {
    ip += f_offset;   // ip past the branch action
}
Action Flash Version: 
4
See Also: 

Pop a Boolean value; if true then jump to the specified action; otherwise continue with the following actions.

There is no Branch If False action. Instead, first use the Logical Not, then Branch If True.

IMPORTANT NOTES