Made to Order Software Corporation Logo

player

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:

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.

DefineBinaryData

Tag Info
Tag Number: 
87
Tag Type: 
Define
Tag Flash Version: 
9
Brief Description: 

Defines a buffer of any size with any binary user data.

Tag Structure: 
struct swf_definebinarydata {
	swf_tag			f_tag;		/* 87 */
	unsigned short		f_data_id;
	unsigned long		f_reserved;	/* must be zero */
	unsigned char		f_data[<variable size>];
};

The DefineBinaryData tag is used to save any arbitrary user defined binary data in an SWF movie. The Flash player itself ignores that data. The size of the data is not specifically limited.

The f_data_id is this object identifier. The identifier is the same type as any identifier (like a sprite identifier.) It is used in ActionScripts to reference the data.

The f_reversed area is 32 bits and it must be set to zero in version 9.

DefineFontAlignZones

Tag Info
Tag Number: 
73
Tag Type: 
Define
Tag Flash Version: 
8
Brief Description: 

Define advanced hints about a font glyphs to place them on a pixel boundary.

Tag Structure: 
struct swf_definefontalignzones {
	swf_tag			f_tag;		/* 73 */
	unsigned short		f_font2_id_ref;
	unsigned		f_csm_table_hint : 2;
	unsigned		f_reserved : 6;
	swf_zone_array		f_zones[corresponding define font3.f_font2_glyphs_count];
};

Since SWF8, this tag was added to allow a clear definition of where a glyph starts. This is a hint to ensure that glyphs are properly drawn on pixel boundaries. Note that it is only partially useful for italic fonts since only vertical hints really make a difference.

The f_font2_id_ref needs to reference the font identifier of a DefineFont3. Each DefineFontAlignZones shall have a different f_font2_id_ref.

FileAttributes

Tag Info
Tag Number: 
69
Tag Type: 
Format
Tag Flash Version: 
8
Brief Description: 

Since version 8, this tag is required and needs to be the very first tag in the movie. It is used as a way to better handle security within the Flash Player.

Tag Structure: 
struct swf_fileattributes {
	swf_tag			f_tag;		/* 69 */
	unsigned		f_reserved : 3;
	unsigned		f_has_metadata : 1;
	unsigned		f_allow_abc : 1;	/* since V9.0 */
	unsigned		f_suppress_cross_domain_caching : 1;	/* since V9.0 */
	unsigned		f_swf_relative_urls : 1;	/* since V9.0 */
	unsigned		f_use_network : 1;
	unsigned		f_reserved : 24;
};

The FileAttributes tag is new to version 8. It must be present in all movies version 8 and over. It must be the very first tag in the SWF movie. It should be unique (other instances will be ignored.)

The f_has_metadata flag shall be set to 1 whenever the movie includes a Metadata tag.

The f_allow_abc flag shall be set to 1 to give the player the right to execute DoABC scripts (this is a version 9 flag, in version 8, keep it set to 0.)

The f_suppress_cross_domain_caching must have some effect over the caching of some things... (version 9+)

The f_swf_relative_urls means that URLs specified ...

DefineVideoStream

Tag Info
Tag Number: 
60
Tag Type: 
Define
Tag Flash Version: 
6
Brief Description: 

Defines the necessary information for the player to display a video stream (i.e. size, codec, how to decode the data, etc.). Play the frames with VideoFrame tags.

Tag Structure: 
struct swf_definevideostream {
	swf_tag			f_tag;		/* 60 */
	unsigned short		f_video_id;
	unsigned short		f_frame_count;
	unsigned short		f_width;	/* WARNING: this is in pixels */
	unsigned short		f_height;
	unsigned char		f_reserved : 5;
	unsigned char		f_deblocking : 2;
	unsigned char		f_smoothing : 1;
	unsigned char		f_codec;
};

This tag defines a video stream. To playback the video stream, one needs to add a list of VideoFrame tags.

The f_width and f_height are defined in pixels. This is rather uncommon in SWF so it is to be noted multiple times.

Export

Tag Info
Tag Number: 
56
Tag Type: 
Define
Tag Flash Version: 
5
Brief Description: 

Exports a list of definitions declared external so they can be used in other movies. You can in this way create one or more movies to hold a collection of objects to be reused by other movies without having to duplicate these in each movie. A single export is enough for an entire movie (and you should have just one).

Tag Structure: 
struct swf_export {
	swf_tag			f_tag;		/* 56 */
	unsigned short		f_count;
	swf_external		f_symbol[f_count];
};

The Export tag works in conjunction with the Import and Import2 tags. The Export tag gives a list of definitions made visible to the external world. Thus these definitions are in effect available to be imported by other movies.

DefineEditText

Tag Info
Tag Number: 
37
Tag Type: 
Define
Tag Flash Version: 
4
Brief Description: 

An edit text enables the end users to enter text in a Flash window.

Tag Structure: 
struct swf_defineedittext {
	swf_tag			f_tag;		/* 37 */
	unsigned short		f_edit_id;
	swf_rect		f_rect;
	unsigned		f_edit_has_text : 1;
	unsigned		f_edit_word_wrap : 1;
	unsigned		f_edit_multiline : 1;
	unsigned		f_edit_password : 1;
	unsigned		f_edit_readonly : 1;
	unsigned		f_edit_has_color : 1;
	unsigned		f_edit_has_max_length : 1;
	unsigned		f_edit_has_font : 1;
	if(version >= 6) {
		unsigned		f_edit_reserved : 1;
		unsigned		f_edit_auto_size : 1;
	}
	else {
		unsigned		f_edit_reserved : 2;
	}
	unsigned		f_edit_has_layout : 1;
	unsigned		f_edit_no_select : 1;
	unsigned		f_edit_border : 1;
	unsigned		f_edit_reserved : 1;
	unsigned		f_edit_html : 1;
	unsigned		f_edit_use_outlines : 1;
	if(f_edit_has_font) {
		unsigned short		f_edit_font_id_ref;
		unsigned short		f_edit_font_height;
	}
	if(f_edit_has_color) {
		swf_rgba		f_edit_color;
	}
	if(f_edit_has_max_length) {
		unsigned short		f_edit_max_length;
	}
	if(f_edit_has_layout) {
		unsigned char		f_edit_align;
		unsigned short		f_edit_left_margin;
		unsigned short		f_edit_right_margin;
		signed short		f_edit_indent;
		signed short		f_edit_leading;
	}
	string			f_edit_variable_name;
	if(f_edit_has_text) {
		string			f_edit_initial_text;
	}
};

Additional interactivity has been added in V4.0 of the SWF format. This is given by the use of edit boxes offering the end users a way to enter text as if the SWF movie was in fact an interactive form.

The text is defined in a variable (accessible in action scripts). It can be dynamically assigned and retrieved. It is legal to have an empty string as the variable name (not dynamically accessible).

Since version 8, the text drawn by a DefineEditText tag can be tweaked by adding a CSMTextSettings tag.

The f_edit_word_wrap flag will be set to true (1) in order to have words going beyond the ...