SWF Condition (swf_condition)

SWF Structure Info
Tag Flash Version: 
1
SWF Structure: 
struct swf_condition {
	unsigned short		f_condition_length;1
	unsigned		f_condition_key : 7;
	unsigned		f_condition_menu_leave : 1;
	unsigned		f_condition_menu_enter : 1;
	unsigned		f_condition_pointer_release_ouside : 1;
	unsigned		f_condition_pointer_drag_enter : 1;
	unsigned		f_condition_pointer_drag_leave : 1;
	unsigned		f_condition_pointer_release_inside : 1;
	unsigned		f_condition_pointer_push : 1;
	unsigned		f_condition_pointer_leave : 1;
	unsigned		f_condition_pointer_enter : 1;
	swf_action		f_action_record[variable];
};
  • 1. The number of actions is variable, the f_condition_length parameter indicates the number of bytes and can be used to skip one condition and all of its actions at once. The action array must always be terminated by an End action entry (i.e 0x00).

A condition is defined in a DefineButton2 tag. It is a record of conditions. The record terminates when the size of the current (i.e. last) condition is zero. The length of that condition can be deduced from the total size of the tag minus the offset where the condition starts. Conditions are similar to events.

The f_key field represents a key code since version 4. The following table gives the code equivalence. Note that 0 means no key.

Key Code Name Version
0 (0x00) No key activation 3
1 (0x01) Left Arrow 4
2 (0x02) Right Arrow 4
3 (0x03) Home 4
4 (0x04) End 4
5 (0x05) Insert 4
6 (0x06) Delete 4
8 (0x08) Backspace 4
13 (0x0D) Enter 4
14 (0x0E) Up Arrow 4
15 (0x0F) Down Arrow 4
16 (0x10) Page Up 4
17 (0x11) Page Down 4
18 (0x12) Tab 4
19 (0x13) Escape 4
32-126 The corresponding ASCII code 4