Made to Order Software Corporation Logo

function

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:

Ord

SWF Action
Action Category: 
String and Characters
Action Details: 
0
Action Identifier: 
50
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 1 (s), push 1 (i)
Action Operation: 
s1 := pop();
r = s1[0];
push(r);
Action Flash Version: 
4

Pop one string, compute the ASCII value of its first character and put it back on the stack.

This function does not take UTF-8 in account. In other words, it can be used to parse a string byte per byte. To get the UTF-8 value of characters, use the Ord (multi-byte) instead.

Number

SWF Action
Action Category: 
Arithmetic
Action Details: 
0
Action Identifier: 
74
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 1 (a), push 1 (n)
Action Operation: 
a1 := pop();
r := a1.valueOf();
push(a1);
Action Flash Version: 
5

Pop one item and transform it into a number (integer or floating point.) If a1 is already a number, it is simply pushed back on the stack.

For strings it works as you would expect (see the strtof(3C) manual pages).

For a user defined object, the method named valueOf() is called. You can declare that function on your own objects to get this action to retrieve the value.

New Method

SWF Action
Action Category: 
Objects
Action Details: 
0
Action Identifier: 
83
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 2 (s), pop 1 (i), pop i3 (a), push (o)
Action Operation: 
s1 := pop();
s2 := pop();
i3 := pop();
for(idx := 4; idx <= i3 + 3; ++idx) {
  aidx := pop();
}
o := new s2;
if (s1.length > 0) {
  o.s1(a4, a5, a6, ... , a(i3 + 3));
}
else {
   o.s2(a4, a5, a6, ... , a(i3 + 3));
}
push(o);
Action Flash Version: 
5

Pop the name of a method (can be the empty string), pop an object1 (created with the Declare Object,) pop the number of arguments, pop each argument, create a new object, then call the specified method (function s1 if defined, otherwise function s2) as the constructor function of the object, push the returned value on the stack. This allows for overloaded constructors as in C++.

  • 1. Yes. This contradicts the definition above. I will have to confirm which is correct.

New

SWF Action
Action Category: 
Objects
Action Details: 
0
Action Identifier: 
64
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 1 (s), pop 1 (i), pop i2 (a)
Action Operation: 
s1 := pop();
i2 := pop();
for(idx := 3; idx <= i2 + 2; ++idx) {
  aidx := pop();
}
o := new s1;
o.s1(a3, a4, ... a(i2 + 2));
push(o);
Action Flash Version: 
5

Pop the class name for the new object to create. Pop the number of arguments. Pop each argument (if i2 is zero, then no arguments are popped.) Create an object of class s1. Call the constructor function (which has the same name as the object class: s1). The result of the constructor is discarded. Push the created object on the stack. The object should then be saved in a variable or object member.

Logical Or

SWF Action
Action Category: 
Logical and Bitwise
Action Details: 
0
Action Identifier: 
17
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 2 (b), push 1 (b)
Action Operation: 
b1 := pop();
b2 := pop();
r := b2 || b1;
push(r);
Action Flash Version: 
4

Pop two values, compute the Logical OR and put the Boolean result back on the stack.

Logical And

SWF Action
Action Category: 
Logical and Bitwise
Action Details: 
0
Action Identifier: 
16
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 2 (b), push 1 (b)
Action Operation: 
b1 := pop();
b2 := pop();
r := b2 && b1;
push(r);
Action Flash Version: 
4

Pop two values, compute the Logical AND and put the Boolean result back on the stack.

Get Variable

SWF Action
Action Category: 
Variables
Action Details: 
0
Action Identifier: 
28
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 1 (s), push 1 (a)
Action Operation: 
s1 := pop();
r := *s1;
push(r);
Action Flash Version: 
4

Pop one string, search for a variable of that name, and push its value on the stack. This action first checks for local variables in the current function. If there isn't such a variable, or the execution is not in a function, then the corresponding global variable is read.

The variable name can include sprite names separated by slashes and finished by a colon as in. Only global variables are accessible in this way.

Example:

Get URL2

SWF Action
Action Category: 
Movie
Action Details: 
0
Action Identifier: 
154
Action Structure: 
unsigned char    f_method;
Action Length: 
1 byte(s)
Action Stack: 
pop 2 (s)
Action Operation: 
s1 := pop();
s2 := pop();
s1.load(s2, f_method);
Action Flash Version: 
4

Pop two strings, the URL (s2) and the target name (s1).

All the usual HTML target names seem to be supported (_top, _blank, <frame name>, etc.) You can also use the special internal names _level0 to _level10. _level0 is the current movie. Other levels, I'm still not too sure how these can be used.

Get URL

SWF Action
Action Category: 
Movie
Action Details: 
0
Action Identifier: 
131
Action Structure: 
string   f_url;
string   f_target;
Action Length: 
-1 byte(s)
Action Stack: 
n.a.
Action Operation: 
f_target.load(f_url);
Action Flash Version: 
1

Load the specified URL in the specified target window.

When the target is set as "_level0", the current SWF file is replaced by the file specified in the f_url field. The name in the f_url field should be a proper SWF file or the area will simply become black.

When the target is set as "_level1", something special is supposed to happen. I still don't know what it is...
Also the effect of _level1 + an empty URL is ... (to remove level1?)