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.

Do not terminate a function with an End action

Prior version 6, the Macromedia player would keep all the data pushed in a function as is when the function returned whether there was a Return action or not. This means some functions that worked in version 6 and earlier may not work anymore in newer versions.

Since version 7, it is preferable to use the new type of functions: Declare Function (V7).

This action is applied to the current target. This means you are indeed creating a function member that gets attached to the current movie (sprite).

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