Made to Order Software Corporation Logo

multiple

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

NameCharacter

Tag Info
Tag Number: 
40
Tag Type: 
Define
Tag Flash Version: 
3
Brief Description: 

Define the name of an object (for buttons, bitmaps, sprites and sounds.)

Tag Structure: 

Unknown

Intended to name objects so one can reference them in an ActionScript. Instead, PlaceObject2 was used which is better since one object can be placed multiple times in your display list and each should have a different name. With the PlaceObject2 tag, it works that way.

Appendix A — The geometry in SWF — Images

When appropriate, images can also be included in SWF files. All the images can be full color and also have an alpha channel.

SWF Sound Info (swf_sound_info)

SWF Structure Info
Tag Flash Version: 
1
SWF Structure: 
struct swf_soundinfo {
	unsigned short		f_sound_id_ref;
	unsigned		f_reserved : 2;
	unsigned		f_stop_playback : 1;
	unsigned		f_no_multiple : 1;
	unsigned		f_has_envelope : 1;
	unsigned		f_has_loops : 1;
	unsigned		f_has_out_point : 1;
	unsigned		f_has_in_point : 1;
	if(f_has_in_point) {
		unsigned long	f_in_point;
	}
	if(f_has_out_point) {
		unsigned long	f_out_point;
	}
	if(f_has_loop_count) {
		unsigned short	f_loop_count;
	}
	if(f_has_envelope) {
		unsigned char	f_envelope_count;
		swf_envelope	f_envelope[f_envelope_count];
	}
};

Information on how to playback a sound effect. These are found in a StartSound and a DefineButtonSound.

The f_sound_id_ref is a reference to an earlier DefineSound tag.

SWF Any Filter (swf_any_filter)

SWF Structure Info
Tag Flash Version: 
8
SWF Structure: 
/* the filter type */
struct swf_filter_type {
	unsigned char	f_type;
};

struct swf_filter_glow {
	swf_filter_type	f_type;		/* 0, 2, 3, 4 or 7 */
	if(f_type == GradientGlow || f_type == GradientBevel) {
		unsigned char		f_count;
	}
	else {
		f_count = 1;
	}
	swf_rgba		f_rgba[f_count];
	if(f_type == Bevel) {
		swf_rgba		f_highlight_rgba[f_count];
	}
	if(f_type == GradientGlow || f_type == GradientBevel) {
		unsigned char		f_position[f_count];
	}
	signed long fixed	f_blur_horizontal;
	signed long fixed	f_blur_vertical;
	if(f_type != Glow) {
		signed long fixed	f_radian_angle;
		signed long fixed	f_distance;
	}
	signed short fixed	f_strength;
	unsigned		f_inner_shadow : 1;
	unsigned		f_knock_out : 1;
	unsigned		f_composite_source : 1;
	if(f_type == Bevel) {
		unsigned		f_on_top : 1;
	}
	else {
		unsigned		f_reserved : 1;
	}
	if(f_type == GradientGlow || f_type == GradientBevel) {
		unsigned		f_passes : 4;
	}
	else {
		unsigned		f_reserved : 4;
	}
};

struct swf_filter_blur {
	swf_filter_type		f_type;	/* 1 */
	unsigned long fixed	f_blur_horizontal;
	unsigned long fixed	f_blur_vertical;
	unsigned		f_passes : 5;
	unsigned		f_reserved : 3;
};

struct swf_filter_convolution {
	swf_filter_type	f_type;		/* 5 */
	unsigned char	f_columns;
	unsigned char	f_rows;
	long float	f_divisor;
	long float	f_bias;
	long float	f_weights[f_columns × f_rows];
	swf_rgba	f_default_color;
	unsigned	f_reserved : 6;
	unsigned	f_clamp : 1;
	unsigned	f_preserve_alpha : 1;
};

struct swf_filter_colormatrix {
	swf_filter_type	f_type;		/* 6 */
	long float	f_matrix[20];
};

struct swf_any_filter {
	swf_filter_type			f_fitler_type;
	swf_filter_blur			f_filter_blur;
	swf_filter_colormatrix		f_filter_colormatrix;
	swf_filter_convolution		f_filter_convolution;
	swf_filter_glow			f_filter_glow;
};

A filter defines how to transform the objects it is attached to. The first byte is the filter type. The data following depend on the type. Because each filter is much different, they are defined in separate structures. You can attach a filter to an object using an ActionScript or the PlaceObject3 tag.

The following describes the different filters available since version 8.

...
Value Name Version
0 Drop Shadow 8

SWF Text Record (swf_text_record)

SWF Structure Info
Tag Flash Version: 
1
SWF Structure: 
struct swf_text_record_end {
	unsigned		f_end : 8;	/* all zeroes */
};

struct swf_text_record_setup {
	unsigned		f_type_setup : 1;	/* always one */
	unsigned		f_reserved : 3;
	unsigned		f_has_font : 1;
	unsigned		f_has_color : 1;
	unsigned		f_has_move_y : 1;
	unsigned		f_has_move_x : 1;
	if(f_has_font) {
		unsigned short		f_font_id_ref;
	}
	if(f_has_color) {
		if(tag == DefineText) {
			swf_rgb		f_color;
		}
		else {	/* if tag is DefineText2 */
			swf_rgba	f_color;
		}
	}
	if(f_has_move_x) {
		signed short		f_move_x;
	}
	if(f_has_move_y) {
		signed short		f_move_y;
	}
	if(f_has_font) {
		unsigned short		f_font_height;
	}
};

struct swf_text_record_glyphs {
	unsigned		f_type_glyph : 1;		/* always zero */
	unsigned		f_glyph_count : 7;		/* at least one */
	swf_text_entry		f_entry[f_glyph_count];
};

struct swf_text_record_string {
	unsigned		f_type_setup : 1;	/* always one */
	unsigned		f_reserved : 3;
	unsigned		f_has_font : 1;
	unsigned		f_has_color : 1;
	unsigned		f_has_move_y : 1;
	unsigned		f_has_move_x : 1;
	if(f_has_font) {
		unsigned short		f_font_id_ref;
	}
	if(f_has_color) {
		if(tag == DefineText) {
			swf_rgb		f_color;
		}
		else {	/* if tag is DefineText2 */
			swf_rgba	f_color;
		}
	}
	if(f_has_move_x) {
		signed short		f_move_x;
	}
	if(f_has_move_y) {
		signed short		f_move_y;
	}
	if(f_has_font) {
		unsigned short		f_font_height;
	}
	unsigned char		f_glyph_count;		/* at least one */
	swf_text_entry		f_entry[f_glyph_count];
};

union swf_text_record {
	unsigned		f_flags : 8;
	swf_text_record_end	f_end;
	if(version >= 7) {
		swf_text_record_string	f_string;
	}
	else {
		swf_text_record_setup	f_setup;
		swf_text_record_glyphs	f_glyphs;
	}
};

The swf_text_record structure is a union composed of a swf_text_record_setup definition followed by characters. Multiple records can follow each others. The list is ended with one byte set to 0.

WARNING: it seems that Macromedia didn't think about a file having two records of type glyph one after another (it makes their plugins crash); you will have to insert a setup record between each glyph record (the setup can be empty: i.e. add one byte equal to 0x80). The very first setup has to at least define the font.

NOTE: this has been corrected by Macromedia it now shows as one structure ...

SWF Line Style (swf_line_style)

SWF Structure Info
Tag Flash Version: 
1
SWF Structure: 
struct swf_line_style {
	if(f_tag == DefineMorphShape) {
		unsigned short twips	f_width;
		unsigned short twips	f_width_morph;
		swf_rgba		f_rgba;
		swf_rgba		f_rgba_morph;
	}
	else if(f_tag == DefineShape4 || f_tag == DefineMorphShape2) {
		unsigned short twips	f_width;
		if(f_tag == DefineMorphShape2) {
			unsigned short twips	f_width_morph;
		}
		unsigned		f_start_cap_style : 2;
		unsigned		f_join_style : 2;
		unsigned		f_has_fill : 1;
		unsigned		f_no_hscale : 1;
		unsigned		f_no_vscale : 1;
		unsigned		f_pixel_hinting : 1;
		unsigned		f_reserved : 5;
		unsigned		f_no_close : 1;
		unsigned		f_end_cap_style : 2;
		if(f_join_style == 2) {
			unsigned short fixed	f_miter_limit_factor;
		}
		if(f_has_fill) {
			swf_fill_style		f_fill_style;
		}
		else {
			swf_rgba		f_rgba;
			if(f_tag == DefineMorphShape2) {
				swf_rgba		f_rgba_morph;
			}
		}
	}
	else if(f_tag == DefineShape3) {
		unsigned short twips	f_width;
		swf_rgba		f_rgba;
	}
	else {
		unsigned short twips	f_width;
		swf_rgb				f_rgb;
	}
};

The width of the line is in TWIPS (1/20th of a pixel).

The f_start_cap_style and f_end_cap_style can be:

  • 0 - Round cap,
  • 1 - No cap,
  • 2 - Square cap.

Round is the default, the way line caps looked before version 8. No Cap means that nothing is added at the tip of the line. This means the line stops exactly where you say it should end. The Square Cap is like the No Cap, but it has the cap which is about Width / 2.

The f_join_style can be:

PlaceObject2

Tag Info
Tag Number: 
26
Tag Type: 
Define
Tag Flash Version: 
3
Brief Description: 

Place, replace, remove an object in the current display list.

Tag Structure: 
struct swf_placeobject2 {	/* and swf_placeobject3 */
	swf_tag			f_tag;		/* 26 or 70 */
	/* NOTE: the following flags can be read as one or two bytes also */
	if(version >= 8) {
		unsigned	f_place_reserved : 5;
		unsigned	f_place_bitmap_caching : 1;
		unsigned	f_place_blend_mode : 1;
		unsigned	f_place_filters : 1;
	}
	if(version >= 5) {
		unsigned	f_place_has_actions : 1;
	}
	else {
		unsigned	f_place_reserved : 1;
	}
	unsigned		f_place_has_clipping_depth : 1;
	unsigned		f_place_has_name : 1;
	unsigned		f_place_has_morph_position : 1;
	unsigned		f_place_has_color_transform : 1;
	unsigned		f_place_has_matrix : 1;
	unsigned		f_place_has_id_ref : 1;
	unsigned		f_place_has_move : 1;
	unsigned short		f_depth;
	if(f_place_has_id_ref) {
		unsigned short		f_object_id_ref;
	}
	if(f_place_has_matrix) {
		swf_matrix		f_matrix;
	}
	if(f_place_has_color_transform) {
		swf_color_transform	f_color_transform;
	}
	if(f_place_has_morph_position) {
		unsigned short		f_morph_position;
	}
	if(f_place_has_name) {
		string			f_name;1
	}
	if(f_place_has_clipping_depth) {
		unsigned short		f_clipping_depth;
	}
	/* 3 next entries since v8.0 */
	if(f_place_filters) {
		unsigned char		f_filter_count;
		swf_any_filter		f_filter;
	}
	if(f_place_blend_mode) {
		unsigned char		f_blend_mode;
	}
	if(f_place_bitmap_caching) {
		/* WARNING: this is not defined in the Macromedia documentation
		 * it may be that it was part of the blend mode whenever the person
		 * who defined this byte was testing (I copied that from somewhere else!).
		 */
		unsigned char		f_bitmap_caching;
	}
	/* since v5.0 */
	if(f_place_has_actions) {
		unsigned short		f_reserved;
		if(version >= 6) {
			unsigned long	f_all_flags;
		}
		else {
			unsigned short	f_all_flags;
		}
		swf_event		f_event[<variable>];
		if(version >= 6) {
			unsigned long	f_end;	/* always zero */
		}
		else {
			unsigned short	f_end;	/* always zero */
		}
	}
};
  • 1. Assuming that this PlaceObject2 references a DefineSprite, this name becomes the name of this instance of the sprite. This feature enables you to place the same DefineSprite multiple times in your display list each time using a different name.

This tag will be used to specify where and how to place an object in the next frame. The PlaceObject is much different and is presented separately.

The f_depth field is used to indicate at which depth the character is inserted in the current frame. There can be only one object per depth value (thus a maximum of 65536 objects can appear on a single frame).

The f_place_has_move and f_place_has_id_ref flags are used to indicate what to do at the given depth. The following table presents what happens depending on the current value.

f_place_has_move ...

SoundStreamHead

Tag Info
Tag Number: 
18
Tag Type: 
Define
Tag Flash Version: 
2
Brief Description: 

Declare a sound effect which will be interleaved with a movie data so as to be loaded over a network connection while being played.

Tag Structure: 
struct swf_soundstreamhead {
	swf_tag			f_tag;		/* 18 or 45 */
	unsigned		f_compression : 4;
	unsigned		f_sound_rate : 2;
	unsigned		f_sound_size : 1;
	unsigned		f_sound_stereo : 1;
	unsigned		f_reserved : 4;
	unsigned		f_playback_rate : 2;
	unsigned		f_playback_size : 1;
	unsigned		f_playback_stereo : 1;
	unsigned short		f_sample_size;
	if(f_compression == 2) {
		signed short	f_latency_seek;
	}
};

The SoundStreamHead[2] tags define a sound effect which is to be loaded with a set of SoundStreamBlock tags. It defines the sound once and for all.

Streaming sound has a strong side effect when playing a movie: it will force a synchronization between the images and the audio. Thus some images may be dropped if the drawing isn't fast enough.

DoAction

Tag Info
Tag Number: 
12
Tag Type: 
Action
Tag Flash Version: 
1
Brief Description: 

Actions to perform at the time the next show frame is reached and before the result is being displayed. It can duplicate sprites, start/stop movie clips, etc.

All the actions within a frame are executed sequentially in the order they are defined.

Important: many actions are not supported in Adobe Flash version 1. Please, see the reference of actions below in order to know which actions can be used with which version of Adobe Flash.

Tag Structure: 
struct swf_doaction {
	swf_tag			f_tag;		/* 12 and 59 */
	if(f_tag == DoInitAction) {
		unsigned short	f_action_sprite;
	}
	swf_action		f_action_record[variable];
};

The DoAction tag will be used to execute a set of actions in place. Usually, actions are used on buttons to add interactivity to the SWF movies. In version 1 you had only one dynamic branch (WaitForFrame). In version 4 you can test many different things such as a position, angle or sound track cursor position. Since version 5, SWF has a complete scripting language supporting string and arithmetic operations.