Made to Order Software Corporation Logo

SWF

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?)

Get Property

SWF Action
Action Category: 
Properties
Action Details: 
0
Action Identifier: 
34
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 1 (n), pop 1 (s), push 1 (a)
Action Operation: 
n1 := pop();
s2 := pop();
r := s2[n1];
push(r);
Action Flash Version: 
4

Query the property n1 of the object named s2 (a field in a structure if you wish), and push the result on the stack. Note that since version 5, it is preferable to use Get Member or Call Method when a corresponding variable or function member is available on the object.

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). It works with a double value, I even tested a Boolean and null and it works. Obviously it isn't a good idea to use these. The default should be a single precision float. Please, see the Push Data action for more information about data types.

WARNING: Adobe is trying to phase out this functionality. It is very likely not working in ABC code and it is not necessary since objects have member functions that can be used for the exact same purpose and it is a lot cleaner to use those instead.

 

Float Decimal Name Comments Version
0x00000000 0 x x position in pixels (not TWIPs!) 4
0x3F800000 1 y y position in pixels (not TWIPs!) 4
0x40000000 2 x scale horizontal scaling factor in percent (50 — NOT 0.5 — represents half the normal size!!!) 4
0x40400000 3 y scale vertical scaling factor in percent (50 — NOT 0.5 — represents half the normal size!!!) 4
0x40800000 4 current frame the very frame being played; one can query the root current frame using an empty string ("") as the name of the object; note that the first current frame is number 1 and the last is equal to the total number of frames; on the other hand, the Goto instruction expects a frame number from 0 to the number of frames - 1 4
0x40A00000 5 number of frames total number of frames in movie/sprite/thread 4
0x40C00000 6 alpha alpha value in percent (50 — NOT 0.5 — means half transparent) 4
0x40E00000 7 visibility whether the object is visible 4
0x41000000 8 width maximum width of the object (scales the object to that width) 4
0x41100000 9 height maximum height of the object (scales the object to that height) 4
0x41200000 10 rotation rotation angle in degrees 4
0x41300000 11 target return the name (full path) of an object; this can be viewed as a reference to that object 4
0x41400000 12 frames loaded number of frames already loaded 4
0x41500000 13 name name of the object 4
0x41600000 14 drop target object over which this object was last dropped 4
0x41700000 15 url URL linked to that object 4
0x41800000 16 high quality whether we are in high quality mode 4
0x41880000 17 show focus rectangle whether the focus rectangle is visible 4
0x41900000 18 sound buffer time position (or pointer) in the sound buffer; useful to synchronize the graphics to the music 4
0x41980000 19 quality what the quality is (0 - Low, 1 - Medium or 2 - High) 5
0x41A00000 20 x mouse current horizontal position of the mouse pointer within the Flash window 5
0x41A80000 21 y mouse current vertical position of the mouse pointer within the Flash window 5
0x46800000 16384 clone this flag has to do with the depth of sprites being duplicated 4

Get Member

SWF Action
Action Category: 
Objects
Action Details: 
0
Action Identifier: 
78
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 1 (a), pop 1 (o), push 1 (a)
Action Operation: 
a1 := pop();
o2 := pop();
r := o2[a1];
push(r);
Action Flash Version: 
5

Pop one string or an integer (member name), pop an object reference, define the value of that object member and push the result back on the stack.

Objects include some special members such as:

FSCommand2

SWF Action
Action Category: 
Miscellaneous
Action Details: 
0
Action Identifier: 
45
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 1 (i), pop i1 (s)
Action Operation: 
i1 := pop();
for(idx := 2; idx < i1 + 2; ++i1) {
  sidx := pop();
}
fscommand2(s2, s3, ..., s(i1 + 1));
Action Flash Version: 
8

Execute the external command (s2) passing on parameters (s3, s4 ... sn.) The external command is likely a JavaScript function.

IMPORTANT NOTES

Ammar Mardawi sent a correction for this action and it looks like it works the way it is described now.

Extends

SWF Action
Action Category: 
Objects
Action Details: 
0
Action Identifier: 
105
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 2 (s), push 1 (o)
Action Operation: 
s1 := pop();
s2 := pop();
super_class := s1;
sub_class := s2;
sub_class.prototype := new object;
sub_class.prototype.__proto__ := super_class.prototype;
sub_class.prototype.__constructor__ := super_class;
push(sub_class.prototype);
Action Flash Version: 
7

The Extends action will be used to define a new object extending another object. The declaration in ActionScript is:

class A extends B;

In an SWF action script, you don't exactly declare objects, you actually instantiate them and define their functions. This action creates a new object named s2 which is an extension of the object s1.

Use this action whenever you need to inherit an object without calling its constructor.

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 ...

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.

Call Function

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

Pops one string that represents the name of the function to call, pop one integer indicating the number of arguments following, pop each argument, call the named function, push the result of the function on the stack. There is always a result1.

  • 1. When nothing is returned by the function, the result undefined is pushed on the stack.

Equal

SWF Action
Action Category: 
Comparisons
Action Details: 
0
Action Identifier: 
14
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 2 (a), push 1 (b)
Action Operation: 
a1 := pop();
a2 := pop();
r := a2 == a1;
push(r);
Action Flash Version: 
4

Pop two values, compare them for equality and put the Boolean result back on the stack.

The != is created by adding a Logical Not after the Equal action.

The way the values are converted is not clearly documented. The fact is that this operation generally transforms the strings into integers or floating points which is not ECMA Script compliant.

This action should only be used in SWF version 4.

Add

SWF Action
Action Category: 
Arithmetic
Action Details: 
0
Action Identifier: 
10
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 2 (n), push 1 (n)
Action Operation: 
n1 := pop();
n2 := pop();
r := n2 + n1;
push(r);
Action Flash Version: 
4

This action pops two numbers from the stack, add them together and put the result back on the stack.

IMPORTANT NOTE

This instruction is not compliant to the ECMA Script reference. It should only be used in SWF files using version 4. Since version 5, the Add (typed) action should be used instead.