Made to Order Software Corporation Logo

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:

96
0C 00
00 't' 'e' 's' 't' 00
00 'm' 'o' 'r' 'e' 00

Most of the time, it is a good idea to push more data and then use the Swap action to reorder. Extra PushData actions require at least 3 bytes when the Swap action is only one.

The following is the table of types accepted in this action:

ID Name Data Comments Version
0x00 String
string	f_string
Push a string on the stack. 4
0x01 Float
(32 bits)
float	f_float;
Push a 32 bits IEEE floating point value on the stack. This type can be used to specify a Property reference. Note that the property reference will be saved as a floating point value though only the integral part will be used. 4
0x02 NULL <none> Push NULL on the stack. This very looks like zero (0) except that it can be used as an object pointer. 5
0x03 Undefined <none> Push an undefined object on the stack. This is not a string, integer, float or Boolean. It simply is an undefined element. Any operation on an undefined element yields undefined except an equal comparison (and some operations such as a Pop). 5
0x04 Register
unsigned char	f_register;
Push the content of the given register on the stack. In the main thread, you have 4 registers in SWF (number 0, 1, 2 and 3). Since SWF version 7, it is possible to use up to 256 registers in a Declare Function (V7). However, outside such a function, the limit is the same. To set a register, use the Store Register action. 5
0x05 Boolean
unsigned char	f_boolean;
Push a Boolean value on the stack (f_boolean needs to be 0 or 1). 5
0x06 Double
(64 bits)
unsigned char	f_value[8];
An IEEE double value saved in a strange way. The following gives you the C code used to read these double values.
double	result;
char	value[8];

value[4] = ReadByte(input_stream);
value[5] = ReadByte(input_stream);
value[6] = ReadByte(input_stream);
value[7] = ReadByte(input_stream);
value[0] = ReadByte(input_stream);
value[1] = ReadByte(input_stream);
value[2] = ReadByte(input_stream);
value[3] = ReadByte(input_stream);

result = * (double *) value;
5
0x07 Integer
unsigned long	f_integer;
Push an integer on the stack. 5
0x08 Dictionary Lookup
unsigned char	f_reference;
Push a string as declared with a Declare Dictionary action. The very first string in a dictionary has reference 0. There can only be up to 256 strings push with this instruction. 5
0x09 Large Dictionary Lookup
unsigned short	f_reference;
Push a string as declared with a Declare Dictionary action. The very first string in a dictionary has reference 0. There can be up to 65534 strings pushed this way. Note that the strings 0 to 255 should use the type 0x08 instead. 5