Made to Order Software Corporation Logo

line

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

Appendix B — History of the SSWF reference

Dec 2, 2009

Moved the monolithic documentation to a multi-page hierarchical document that includes everything we had before plus many links, many terms attached to all pages (tags, English words.) And revision of most of the text for better English and clarification in some places.

Strengthen the formatting with CCK fields so all declarations look alike.

Broken up the actions from one large table to a set of pages.

Dec 14, 2008

Started work on the Load() feature of the SSWF library. This helped fixing several small mistakes in the documentation.

May 18, 2008

Fixed the ...

Appendix A — The geometry in SWF — Edges

Edges are used to define a shape vector based and also coordinates where images need to be drawn. The edges are always coordinates from where ever your last point was to where ever you want the next point to be (a little like a turtle in LOGO).

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:

SWF Line Style Array (swf_line_style_array)

SWF Structure Info
Tag Flash Version: 
1
SWF Structure: 
struct swf_line_style_array {
	unsigned char		f_count;
	if(f_tag != DefineShape && f_count == 255) {
		unsigned short	f_real_count;
	}
	else {
		f_real_count = f_count;
	}
	swf_line_style		f_line_style[f_real_count];
};

The array of line styles starts with a counter. When DefineShape is used, the counter can be any value from 0 (no style) to 255. When DefineShape2 or DefineShape3 are used, the value 255 is reserved so you can declare more than 255 styles (up to 65535.)

SWF Styles Count (swf_styles_count)

SWF Structure Info
Tag Flash Version: 
1
SWF Structure: 
struct swf_styles {1
	unsigned char		f_fill_bits_count : 4;
	unsigned char		f_line_bits_count : 4;
};
  • 1. Since always aligned, you can read one byte and mask/shift bits quickly on this one.

Note that the line & fill bits are declared as "unsigned char" because they will always be aligned. The proper definition would probably be a bit field though.

SWF Shape (swf_shape)

SWF Structure Info
Tag Flash Version: 
1
SWF Structure: 
struct swf_shape {
	swf_styles_count	f_styles_count;
	swf_shape_record	f_shape_records[variable];
};

Fonts uses this declaration. It does not include any style (fill or line) definitions. The drawing will use fill 0 when the inside of the shape should not be drawn and 1 when it is to be filled. The line style should not be defined.

FreeAll

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

Probably an action that would be used to clear everything out.

Tag Structure: 

Unknown

This is an interesting concept: have a tag that can clear everything that we have done so far and start over. If you have a single time line, this is certainly useful. Since version 3, however, we get the DefineSprite tag that has a very similar capability (except that it does not have the ability to delete anything from memory, this comes in version 5 with access to external animations that can be created and thrown away dynamically.)

DefineFont

Tag Info
Tag Number: 
10
Tag Type: 
Define
Tag Flash Version: 
1
Brief Description: 

List shapes corresponding to glyphs.

Tag Structure: 
struct swf_definefont {
	swf_tag			f_tag;		/* 10 */
	unsigned short		f_font_id;
	/* there is always at least one glyph */
	f_font_glyphs_count = f_font_offsets[0] / 2;
	unsigned short		f_font_offsets[f_font_glyphs_count];
	swf_shape		f_font_shapes[f_font_glyphs_count];
};

It is common to use the DefineFont tag in order to create an array of shapes later re-used to draw strings of text on the screen. Note that the definition of the shape within a font is limited since it can't include any specific fill and/or line style. Also, each shape is assumed to be defined within a 1024x1024 square. This square is called the EM Square. Fig 1. below shows you the EM Square and how it is used. The characters baseline can be placed anywhere within the EM Square (it certainly can be outside too if you wish?!?).

DefineShape

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

Define a simple geometric shape.

Tag Structure: 
struct swf_defineshape {
	swf_tag				f_tag;		/* 2, 22, 32, 46, 83, or 84 */
	unsigned short			f_shape_id;
	swf_rect			f_rect;
	is_morph = f_tag == DefineMorphShape || f_tag == DefineMorphShape2;
	has_strokes = f_tag == DefineShape4 || f_tag == DefineMorphShape2;
	if(is_morph) {
		swf_rect			f_rect_morph;
	}
	if(has_strokes) {
		swf_rect			f_stroke_rect;
		if(is_morph) {
			swf_rect			f_stroke_rect_morph;
		}
		unsigned			f_define_shape_reserved : 6;
		unsigned			f_define_shape_non_scaling_strokes : 1;
		unsigned			f_define_shape_scaling_strokes : 1;
	}
	if(is_morph) {
		unsigned long			f_offset_morph;
		swf_morph_shape_with_style	f_morph_shape_with_style;
	}
	else {
		swf_shape_with_style		f_shape_with_style;
	}
};

These are probably the most important tags in this reference. They are used to define a shape using Bezier curves and lines with different styles. The DefineShape of V1.0 is usually enough unless you need a large number of styles or you want to specify colors with an alpha channel (RGBA).