Made to Order Software Corporation Logo

libsswf: sswf::Event Class Reference

The Event class used to declare the events a button or place object support. More...

#include <libsswf.h>

Inheritance diagram for sswf::Event:

:MemoryManager :ItemBase :MemBuffer

List of all members.


Public Types

enum  condition_flag_t {
  CONDITION_KEY_MASK = 0xFE00, CONDITION_KEY_SHIFT = 9, CONDITION_MENU_LEAVE = 0x0100, CONDITION_MENU_ENTER = 0x0080,
  CONDITION_POINTER_RELEASE_OUTSIDE = 0x0040, CONDITION_POINTER_DRAG_ENTER = 0x0020, CONDITION_POINTER_DRAG_LEAVE = 0x0010, CONDITION_POINTER_RELEASE_INSIDE = 0x0008,
  CONDITION_POINTER_PUSH = 0x0004, CONDITION_POINTER_LEAVE = 0x0002, CONDITION_POINTER_ENTER = 0x0001
}
 Set of conditions understood by the TagButton. More...
enum  event_flag_t {
  EVENT_COND_MENU_LEAVE = 0x80000000, EVENT_COND_MENU_ENTER = 0x40000000, EVENT_CONSTRUCT = 0x00040000, EVENT_KEY_PRESS = 0x00020000,
  EVENT_POINTER_DRAG_LEAVE = 0x00010000, EVENT_POINTER_DRAG_ENTER = 0x00008000, EVENT_POINTER_LEAVE = 0x00004000, EVENT_POINTER_ENTER = 0x00002000,
  EVENT_POINTER_RELEASE_OUTSIDE = 0x00001000, EVENT_POINTER_RELEASE_INSIDE = 0x00000800, EVENT_POINTER_PUSH = 0x00000400, EVENT_INITIALIZE = 0x00000200,
  EVENT_DATA = 0x00000100, EVENT_KEY_UP = 0x00000080, EVENT_KEY_DOWN = 0x00000040, EVENT_POINTER_UP = 0x00000020,
  EVENT_POINTER_DOWN = 0x00000010, EVENT_POINTER_MOVE = 0x00000008, EVENT_UNLOAD = 0x00000004, EVENT_ENTER_FRAME = 0x00000002,
  EVENT_ONLOAD = 0x00000001
}
 Enumeration used to define a set of condition flags. More...
enum  key_code_t {
  KEY_CODE_NONE = 0, KEY_CODE_LEFT_ARROW = 1, KEY_CODE_RIGHT_ARROW = 2, KEY_CODE_HOME = 3,
  KEY_CODE_END = 4, KEY_CODE_INSERT = 5, KEY_CODE_DELETE = 6, KEY_CODE_BACKSPACE = 8,
  KEY_CODE_ENTER = 13, KEY_CODE_UP_ARROW = 14, KEY_CODE_DOWN_ARROW = 15, KEY_CODE_PAGE_UP = 16,
  KEY_CODE_PAGE_DOWN = 17, KEY_CODE_TAB = 18, KEY_CODE_ESCAPE = 19, KEY_CODE_SPACE = 20
}
 The enumeration representing all the ASCII key codes. More...

Public Member Functions

VectorsActions (void)
 Get the array of actions of this event.
unsigned long Conditions (void) const
 Converts the events in conditions.
 Event (void)
 Initialize an event object.
unsigned long Events (void) const
 Reads the current events mask.
unsigned char Key (void) const
 Reset an event object.
void Reset (void)
 Reset an event object.
void SetConditions (unsigned long events)
 Converts conditions in events.
void SetEvents (unsigned long events)
 Set event flags.
void SetKey (unsigned char key)
 Setup a key in that event.

Static Public Member Functions

static unsigned long StringToEvents (const char *s)
 Converts a set of events in a mask of bits.
static unsigned char StringToKeyCode (const char *s)
 Converts a string into a key code.

Static Public Attributes

static const event_names_t g_event_names [SSWF_EVENT_COUNT]
 Event names.
static const key_names_t g_key_names [SSWF_KEY_COUNT]
 Special key names.

Private Attributes

Vectors f_actions
unsigned long f_events
unsigned char f_key

Classes

struct  event_names_t
 Internal structure used to save event name names and their corresponding bits. More...
struct  key_names_t
 This is an internal structure used to list keys and their code. More...

Detailed Description

This class is used to define the events of a TagButton or a TagPlace. Both of these objects support the same events.

See also:
SWF Alexis' Reference—swf_event

Member Enumeration Documentation

This enumeration lists the flags understood by the TagButton obect. The Events flags can be transformed into a mask of condition flags using the Event::Conditions(void) const function.

Bug:
If flags which are only for the TagPlace are set in an event added to a TagButton, an error will occur.
See also:
sswf::Event::Conditions(void) const

sswf::TagButton::AddEvent(Event *event)

Enumerator:
CONDITION_KEY_MASK  Mask of bits reserved for the key code.

Whenever a key code is specified, it is saved in these bits. Notice that the code is limited to 7 bits only. In order to support international key code, one needs to use an event with the sswf::Event::EVENT_KEY_UP or sswf::Event::EVENT_KEY_DOWN.

See also:
sswf::Event::Conditions(void) const

sswf::TagButton::AddEvent(Event *event)

sswf::Event::EVENT_KEY_UP

sswf::Event::EVENT_KEY_DOWN

sswf::Event::CONDITION_KEY_SHIFT


CONDITION_KEY_SHIFT  Number of bits the key code needs to be shifted.

The number of bits the key code needs to be shifted to be included in a condition mask.

See also:
sswf::Event::Conditions(void) const

sswf::TagButton::AddEvent(Event *event)

sswf::Event::CONDITION_KEY_MASK


CONDITION_MENU_LEAVE  Event received whenever the mouse leaves a menu.

A button can be used to create a menu type of widget. This event can be used to know whenever the menu is being exited by the mouse pointer.

See also:
sswf::Event::Conditions(void) const

sswf::TagButton::AddEvent(Event *event)

sswf::Event::CONDITION_POINTER_DRAG_LEAVE

sswf::Event::CONDITION_POINTER_LEAVE

sswf::Event::CONDITION_MENU_ENTER


CONDITION_MENU_ENTER  Event received whenever the mouse enters a menu.

A button can be used to create a menu type of widget. This event can be used to know whenever the menu is being entered by the mouse pointer.

See also:
sswf::Event::Conditions(void) const

sswf::TagButton::AddEvent(Event *event)

sswf::Event::CONDITION_POINTER_DRAG_ENTER

sswf::Event::CONDITION_POINTER_ENTER

sswf::Event::CONDITION_MENU_LEAVE


CONDITION_POINTER_RELEASE_OUTSIDE  Event received when the mouse button is released outside of the event object.

This event is sent whenever the mouse button was clicked the event object but relased outside of the event object.

See also:
sswf::Event::Conditions(void) const

sswf::TagButton::AddEvent(Event *event)

sswf::Event::CONDITION_POINTER_RELEASE_INSIDE


CONDITION_POINTER_DRAG_ENTER  Event received whenever the mouse pointer enters the event object.

This event is sent whenever the mouse pointer enters the event object and is used to drag another object.

See also:
sswf::Event::Conditions(void) const

sswf::TagButton::AddEvent(Event *event)

sswf::Event::CONDITION_POINTER_ENTER

sswf::Event::CONDITION_MENU_ENTER

sswf::Event::CONDITION_POINTER_DRAG_LEAVE


CONDITION_POINTER_DRAG_LEAVE  Event received whenever the mouse pointer leaves the event object.

This event is sent whenever the mouse pointer leaves the event object and is used to drag another object.

See also:
sswf::Event::Conditions(void) const

sswf::TagButton::AddEvent(Event *event)

sswf::Event::CONDITION_POINTER_PUSH

sswf::Event::CONDITION_POINTER_LEAVE

sswf::Event::CONDITION_POINTER_DRAG_ENTER


CONDITION_POINTER_RELEASE_INSIDE  Event received whenever the mouse button is released inside the event object.

This message is received after the used clicked in the event object and released the mouse button when the mouse pointer was still inside the event object.

This is the event to use to react as a standard UI button.

See also:
sswf::Event::Conditions(void) const

sswf::TagButton::AddEvent(Event *event)

sswf::Event::CONDITION_POINTER_PUSH

sswf::Event::CONDITION_POINTER_RELEASE_OUTSIDE


CONDITION_POINTER_PUSH  Event received when the mouse button is clicked inside the event object.

The user clicked on the event object. Notice that this event is sent when the mouse button is still pushed. If you want to have the button reacts as a usual UI button, you may want to use the sswf::Event::CONDITION_POINTER_RELEASE_INSIDE instead.

See also:
sswf::Event::Conditions(void) const

sswf::TagButton::AddEvent(Event *event)

sswf::Event::CONDITION_POINTER_RELEASE_INSIDE


CONDITION_POINTER_LEAVE  Event received whenever the mouse pointer leaves the event object.

Detects when the mouse leaves your event object active area.

Note that under Linux it does not detect all cases. For instance, if the mouse leaves the SWF window entirely, you usually don't receive this event. Similarly, if a window opens in front of the SWF plugin, the event is not sent.

See also:
sswf::Event::Conditions(void) const

sswf::TagButton::AddEvent(Event *event)

sswf::Event::CONDITION_POINTER_DRAG_LEAVE

sswf::Event::CONDITION_MENU_LEAVE

sswf::Event::CONDITION_POINTER_ENTER


CONDITION_POINTER_ENTER  Event received whenever the mouse pointer enters the event object.

This event is sent whenever the system detects that the mouse pointer is moved over your event object.

Note that when the user moves his mouse pointer really fast, the object may never be hit in this way.

See also:
sswf::Event::Conditions(void) const

sswf::TagButton::AddEvent(Event *event)

sswf::Event::CONDITION_POINTER_DRAG_ENTER

sswf::Event::CONDITION_MENU_ENTER

sswf::Event::CONDITION_POINTER_LEAVE

This enumeration lists the set of flags used to define an event condition. The events can be used with the TagButton or the TagPlace objects.

All condition flags are not available for both tags. The button accept two conditions in link with implementing menu like functionality. The place object accept all the other flags at this time.

The place object can also be used to create a class definition which later can be instantiated in an object with the new operator.

Bug:
If a TagButton flag is specified in an event used for a TagPlace, an error will occur when you try to save the movie.
If a TagPlace flag is specified in an event used for a TagButton, an error will occur when you try to save the movie.
See also:
sswf::TagButton::AddEvent(Event *event)

sswf::TagPlace::AddEvent(Event *event)

Enumerator:
EVENT_COND_MENU_LEAVE  Event signaling that the mouse pointer left the corresponding menu.

This event is specific to the TagButton object.

This flag appeared in version 3 of SWF.

This flag can only be used with a DefineButton2 object.

See also:
sswf::TagButton::AddEvent(Event *event)

EVENT_COND_MENU_ENTER  Event signaling that the mouse pointer entered the corresponding menu.

This event is specific to the TagButton object.

This flag appeared in version 3 of SWF.

This flag can only be used with a DefineButton2 object.

See also:
sswf::TagButton::AddEvent(Event *event)

EVENT_CONSTRUCT  Event received once whenever the corresponding object is created.

This event is used to write a constructor in an object. This is used for the constructor of objects as defined in Javascript. Yet, it is not possible to select such a constructor depending on parameters.

This flag appeared in version 7 of SWF.

See also:
sswf::TagPlace::AddEvent(Event *event)

EVENT_KEY_PRESS  Event reveiced whenever a key is pressed.

This event is sent when the SWF movie has the focus and no text box is currently selected (focused.)

This flag appeared in version 6 of SWF.

See also:
sswf::TagPlace::AddEvent(Event *event)

EVENT_POINTER_DRAG_LEAVE  Event received while dragging an object outside of this event object.

This event is sent to the event object whenever the mouse pointer is dragging an object outside of this object active area.

This flag appeared in version 6 of SWF.

This flag can be used with a DefineButton2 object.

See also:
sswf::TagButton::AddEvent(Event *event)

sswf::TagPlace::AddEvent(Event *event)


EVENT_POINTER_DRAG_ENTER  Event received while dragging an object inside of this event object.

This event is sent to the event object whenever the mouse pointer is dragging an object is enters this object active area.

This flag appeared in version 5 of SWF.

This flag can be used with a DefineButton2 object.

See also:
sswf::TagButton::AddEvent(Event *event)

sswf::TagPlace::AddEvent(Event *event)


EVENT_POINTER_LEAVE  Event received when the mouse pointer exits this object.

This event is sent to the event object whenever the mouse pointer is leaving the object active area.

This flag appeared in version 5 of SWF.

This flag can be used with a DefineButton2 object.

See also:
sswf::TagButton::AddEvent(Event *event)

sswf::TagPlace::AddEvent(Event *event)


EVENT_POINTER_ENTER  Event received when the mouse pointer enters this object.

This event is sent to the event object whenever the mouse pointer is entering the object active area.

This flag appeared in version 5 of SWF.

This flag can be used with a DefineButton2 object.

See also:
sswf::TagButton::AddEvent(Event *event)

sswf::TagPlace::AddEvent(Event *event)


EVENT_POINTER_RELEASE_OUTSIDE  Event received when the mouse button is released outside.

This event is sent to the event object whenever the user clicked inside this event object but released the mouse button once outside of the object.

This flag appeared in version 5 of SWF.

This flag can be used with a DefineButton2 object.

See also:
sswf::TagButton::AddEvent(Event *event)

sswf::TagPlace::AddEvent(Event *event)


EVENT_POINTER_RELEASE_INSIDE  Event received when the mouse button is released inside.

This event is sent to the event object whenever the user clicked inside this event object and released the mouse button while still inside the object.

This flag appeared in version 5 of SWF.

This flag can be used with a DefineButton2 object.

See also:
sswf::TagButton::AddEvent(Event *event)

sswf::TagPlace::AddEvent(Event *event)


EVENT_POINTER_PUSH  Event received when the user push a mouse button.

This event is sent at the time the user pushes a button over an event object.

This flag appeared in version 5 of SWF.

This flag can be used with a DefineButton2 object.

See also:
sswf::TagButton::AddEvent(Event *event)

sswf::TagPlace::AddEvent(Event *event)


EVENT_INITIALIZE  Event received to initialize a new instance of an object.

This event is sent whenever an object is duplicated to re-initialize variables. This event is somewhat similar to the sswf::Event::EVENT_CONSTRUCT but I have no idea what the differences are. I think that since version 7 of SWF, one should use the construct event instead of this one.

This flag appeared in version 5 of SWF.

Note:
This flag is supposed to be used by itself.
See also:
sswf::TagPlace::AddEvent(Event *event)

EVENT_DATA  Event received ?

I have no idea what this is for.

This flag appeared in version 5 of SWF.

See also:
sswf::TagPlace::AddEvent(Event *event)

EVENT_KEY_UP  Event received whenever the user releases a key.

An event object can be setup to receive a signal whenever a key is released. Use an ActionScript Key object to know which key was released.

This key event is not linked with the sswf::Event::EVENT_KEY_PRESS which is a specific ASCII key assigned to the event object.

This flag appeared in version 6 of SWF.

See also:
sswf::TagPlace::AddEvent(Event *event)

EVENT_KEY_DOWN  Event received whenever the user presses a key.

An event object can be setup to receive a signal whenever a key is pressed down. Use an ActionScript Key object to know which key was released.

This key event is not linked with the sswf::Event::EVENT_KEY_PRESS which is a specific ASCII key assigned to the event object.

You may want to consider using the sswf::Event::EVENT_KEY_UP instead of this event. In most cases, it is better adapted.

This flag appeared in version 6 of SWF.

See also:
sswf::TagPlace::AddEvent(Event *event)

EVENT_POINTER_UP  Event received when a mouse button is released over the event object.

This event is sent when the mouse button is released over the event object. This does not guarantee that the mouse button was pushed over the same event object. In order to check for a mouse click on an object, use the sswf::Event::EVENT_POINTER_RELEASE_INSIDE event instead.

This flag appeared in version 6 of SWF.

See also:
sswf::TagPlace::AddEvent(Event *event)

EVENT_POINTER_DOWN  Event received when the user clicks the event object.

This event is sent whenever the user clicks with a mouse button over the event object.

If you are writing a button, you should use the sswf::Event::EVENT_POINTER_RELEASE_INSIDE to know when the user clicked the button.

This flag appeared in version 6 of SWF.

See also:
sswf::TagPlace::AddEvent(Event *event)

EVENT_POINTER_MOVE  Event received when the mouse move within this object.

An object marked with this event receives all the mouse movement information.

This flag appeared in version 6 of SWF.

See also:
sswf::TagPlace::AddEvent(Event *event)

EVENT_UNLOAD  Event received whenever the object is unloaded.

This event can occurs only if you first load sub-movies. It is sent to the object whenever that sub-movie is deleted. This gives you a chance to do some extra cleanup.

This flag appeared in version 6 of SWF.

See also:
sswf::TagPlace::AddEvent(Event *event)

EVENT_ENTER_FRAME  Event received whenever the object enters the frame?

I'm still not too sure what this flag is for...

This flag appeared in version 6 of SWF.

See also:
sswf::TagPlace::AddEvent(Event *event)

EVENT_ONLOAD  Event received whenever the sample object is loaded.

This event lets you initialize the event object once when first loading the movie. This is useful to make an object available to the user. At least, this is the technique used by Macromedia to initialize classes on startup.

Also, this event can be used to know once a specific object was loaded (especially if the SWF is used on a modem, it can take a while to load!)

If you need a constructor for your object, use the EVENT_CONSTRUCT instead or call a construction function as required.

This flag appeared in version 5 of SWF.

See also:
sswf::TagPlace::AddEvent(Event *event)

This enumeration specifically lists the key codes which are not standard ASCII codes such as the arrows, Home, End, Escape keys.

If you need to catch international keys, use the sswf::Event::EVENT_KEY_UP or sswf::Event::EVENT_KEY_DOWN instead. Those events are triggered whatever the key and the code is saved in the ActionScript Key object.

This code is used whenever the sswf::Event::EVENT_KEY_PRESS flag is set. Note that this flag is set automatically whenever the sswf::Even::SetKey(unsigned char key) function is called.

It is expected that the corresponding keypad keys will be generating the same events when NumLock is not turned on.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const

sswf::Event::EVENT_KEY_UP

sswf::Event::EVENT_KEY_DOWN

sswf::Event::EVENT_KEY_PRESS

Enumerator:
KEY_CODE_NONE  Special key code representing no key.

This key code represents no key. When used with the SetKey(unsigned char key) function, it clears the key from the corresponding event.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


KEY_CODE_LEFT_ARROW  Special key code representing the Left Arrow key.

This key code catches the special Left Arrow key on the keyboard.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


KEY_CODE_RIGHT_ARROW  Special key code representing the Right Arrow key.

This key code catches the special Right Arrow key on the keyboard.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


KEY_CODE_HOME  Special key code representing the Home key.

This key code catches the special key named Home on the keyboard.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


KEY_CODE_END  Special key code representing the End key.

This key code catches the special key named End on the keyboard.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


KEY_CODE_INSERT  Special key code representing the Insert key.

This key code catches the special key named Insert (or Ins.) on the keyboard.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


KEY_CODE_DELETE  Special key code representing the Delete key.

This key code catches the special key named Delete (or Del.) on the keyboard.

Some keyboard may interpret the Backspace key as the Delete key and vice versa.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


KEY_CODE_BACKSPACE  Special key code representing the Backspace key.

This key code catches the special key named Backspace (or |<-) on the keyboard.

Some keyboard may interpret the Backspace key as the Delete key and vice versa.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


KEY_CODE_ENTER  Special key code representing the Enter key.

This key code catches the special key named Enter or Return on the keyboard.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


KEY_CODE_UP_ARROW  Special key code representing the Up Arrow key.

This key code catches the special Up Arrow key on the keyboard.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


KEY_CODE_DOWN_ARROW  Special key code representing the Down Arrow key.

This key code catches the special Down Arrow key on the keyboard.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


KEY_CODE_PAGE_UP  Special key code representing the Page Up key.

This key code catches the special Page Up key on the keyboard.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


KEY_CODE_PAGE_DOWN  Special key code representingthe Page Down key.

This key code catches the special Page Down key on the keyboard.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


KEY_CODE_TAB  Special key code representing the Tab key.

This key code catches the special Tab key on the keyboard.

Note that Shift-Tab is caught too. To distinguish between both forms, you need to use the ActionScript Key object and check for the Shift key flags.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


KEY_CODE_ESCAPE  Special key code representing the Escape key.

This key code catches the special key named Escape (or Ecs.) on the keyboard.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


KEY_CODE_SPACE  Special key code representing Space key.

This key code catches the Space key. This is equivalent to using the ASCII space (' ') character.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const


Constructor & Destructor Documentation

Event::Event ( void   ) 

By default an event object is initialized to a "no event" Event.

See also:
sswf::Event::Reset(void)

References Reset().


Member Function Documentation

Vectors & Event::Actions ( void   ) 

This functions returns a direct reference to the array of actions available in this event object.

This array can be used to read the existing actions or to add new actions to the event.

Actions are executed whenever the corresponding event is triggered.

Use of the Reset() function deletes all the actions saved in this array.

See also:
sswf::Event::Reset(void)

References f_actions.

Referenced by sswf::TagButton::ParseTag(), sswf::TagPlace::PreSave(), sswf::TagButton::PreSave(), sswf::TagPlace::Save(), and sswf::TagButton::Save().

unsigned long Event::Conditions ( void   )  const

unsigned long Event::Events ( void   )  const

This functions returns the current events mask. This includes all the events which will generate a reaction in the attached object.

This value is used with the SWF_TAG_PLACE_OBJECT2 (v3) and SWF_TAG_PLACE_OBJECT3 (v8) tags.

See also:
sswf::Event::SetEvents(unsigned long events)

sswf::Event::SetKey(unsigned char key)

sswf::Event::SetConditions(unsigned long conditions)

sswf::Event::Conditions(void) const

sswf::Event::Events(void) const

References f_events.

Referenced by sswf::TagPlace::AddEvent(), sswf::TagButton::AddEvent(), sswf::TagButton::PreSave(), and sswf::TagPlace::Save().

unsigned char Event::Key ( void   )  const

This functions returns the current key assigned to this event.

By default the key is set to Event::KEY_CODE_NONE.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::SetEvents(unsigned long events)

References f_key.

Referenced by sswf::TagPlace::Save().

void Event::Reset ( void   ) 

This function marks the Event object as empty. This is the same as a newly created Event object.

See also:
sswf::Event::Event()

References sswf::Vectors::Count(), sswf::Vectors::Empty(), f_actions, f_events, and sswf::Vectors::Get().

Referenced by Event().

void Event::SetConditions ( unsigned long  conditions  ) 

This functions converts the condition bits passed as parameter into a set of event flags and save those in the Event object.

This function is similar to the SetEvents() function, which saves the current events, plus the conversion.

This value is used with the SWF_TAG_DEFINE_BUTTON2 tag.

Note:
If the key is defined (bits 9 to 15), meaning that it is not zero, then the EVENT_KEY_PRESS flag is set.
See also:
sswf::Event::SetEvents(unsigned long events)

sswf::Event::Events(void) const

sswf::Event::Conditions(void) const

References CONDITION_KEY_MASK, CONDITION_KEY_SHIFT, CONDITION_MENU_ENTER, CONDITION_MENU_LEAVE, CONDITION_POINTER_DRAG_ENTER, CONDITION_POINTER_DRAG_LEAVE, CONDITION_POINTER_ENTER, CONDITION_POINTER_LEAVE, CONDITION_POINTER_PUSH, CONDITION_POINTER_RELEASE_INSIDE, CONDITION_POINTER_RELEASE_OUTSIDE, EVENT_COND_MENU_ENTER, EVENT_COND_MENU_LEAVE, EVENT_KEY_PRESS, EVENT_POINTER_DRAG_ENTER, EVENT_POINTER_DRAG_LEAVE, EVENT_POINTER_ENTER, EVENT_POINTER_LEAVE, EVENT_POINTER_PUSH, EVENT_POINTER_RELEASE_INSIDE, EVENT_POINTER_RELEASE_OUTSIDE, f_events, and f_key.

Referenced by sswf::TagButton::ParseTag().

void Event::SetEvents ( unsigned long  events  ) 

This function sets the events mask to the specified set of flags. All the following flags can be used. Use the or (|) operator to merge multiple flags together.

To change the flags currently set, one may call Events() first to read the currently defined flags, and then SetEvents() with the new mask.

If you include the EVENT_KEY_PRESS, you need to also call the SetKey(unsigned char key) function.

See also:
sswf::Event::Events(void) const

sswf::Event::SetKey(unsigned char key)

sswf::Event::SetConditions(unsigned long conditions)

sswf::Event::Conditions(void) const

References f_events.

void Event::SetKey ( unsigned char  key  ) 

An event can react to the mouse and the keyboard. To activate the keyboard functionality, you need to setup a key. The object forces the EVENT_KEY_PRESS flag in the events mask.

The characters 32 to 126 can be used as is and they represent the corresponding ASCII character (space, 0, 1, 2, A, B, etc.)

The following special keys are also available:

Note that setting the key to KEY_CODE_NONE cancels a previous SetKey() call.

If you offer an end user a way to name a key, you may want to use the StringToKeyCode(const char *s) to first convert the name of the key into a valid keycode.

See also:
sswf::Event::Events(void) const

sswf::Event::SetEvents(unsigned long events)

sswf::Event::StringToKeyCode(const char *s)

References EVENT_KEY_PRESS, f_events, f_key, and KEY_CODE_NONE.

unsigned long Event::StringToEvents ( const char *  s  )  [static]

This functions transforms an ASCII string in a set of bits representing the corresponding mask of events. The mask returned by this function can later be used with the SetEvents(unsigned long events) function.

The string is composed of event names separated by commas. Extraneous spaces before and after each name are silently ignored. Events can be specified either as a name or as a number. The number can be specified in decimal, hexadecimal or octal.

The following table lists the event names that this function can convert:

  // V5.x
  ONLOAD
  POINTER_DRAG_ENTER
  POINTER_LEAVE
  POINTER_ENTER
  POINTER_RELEASE_OUTSIDE
  POINTER_RELEASE_INSIDE
  POINTER_PUSH
  INITIALIZE
  DATA
  
  // V6.x
  KEY_PRESS
  KEY_UP
  KEY_DOWN
  POINTER_UP
  POINTER_DOWN
  POINTER_MOVE
  UNLOAD
  ENTER_FRAME
  DRAG_LEAVE
  
  // Extras for DefineButton2
  MENU_ENTER
  MENU_LEAVE

The event names are case insensitive.

Bug:
At this time, this function asserts() in debug mode when the input string is invalid. There is otherwise no error reported to the caller.
The function will ignore names which are more than 31 characters.
See also:
sswf::Event::SetEvents(unsigned long events)

sswf::Event::Events(void) const

sswf::Event::g_event_names

References sswf::assert(), sswf::Event::event_names_t::f_flag, g_event_names, and SSWF_EVENT_COUNT.

unsigned char Event::StringToKeyCode ( const char *  s  )  [static]

This functions converts the specified string into a valid SWF keycode. The input string is taken as an ASCII string.

A key such as "A", "0" and "?" is returned as is.

A special key such as "LEFT_ARROW" and "HOME" is converted to the corresponding KEY_CODE_<name> keycode. The following table lists the currently understood key names:

  LEFT_ARROW
  RIGHT_ARROW
  HOME
  END
  INSERT
  DELETE
  BACKSPACE
  ENTER
  UP_ARROW
  DOWN_ARROW
  PAGE_UP
  PAGE_DOWN
  TAB
  ESCAPE
  SPACE

The comparison is case insensitive, but the underscore (_) must be an underscore. If you want your users to be able to type a space, then you need to first convert the spaces into underscores.

If the name passed does not correspond to a valid key, then the function returns KEY_CODE_NONE.

See also:
sswf::Event::SetKey(unsigned char key)

sswf::Event::Key(void) const

sswf::Event::g_key_names

References sswf::Event::key_names_t::f_code, g_key_names, KEY_CODE_NONE, and SSWF_EVENT_COUNT.


Member Data Documentation

Referenced by Actions(), and Reset().

unsigned long sswf::Event::f_events [private]

unsigned char sswf::Event::f_key [private]

Referenced by Conditions(), Key(), SetConditions(), and SetKey().

Initial value:

 {
        
        { EVENT_ONLOAD,                 "ONLOAD" },
        { EVENT_POINTER_DRAG_ENTER,     "POINTER_DRAG_ENTER" },
        { EVENT_POINTER_LEAVE,          "POINTER_LEAVE" },
        { EVENT_POINTER_ENTER,          "POINTER_ENTER" },
        { EVENT_POINTER_RELEASE_OUTSIDE,"POINTER_RELEASE_OUTSIDE" },
        { EVENT_POINTER_RELEASE_INSIDE, "POINTER_RELEASE_INSIDE" },
        { EVENT_POINTER_PUSH,           "POINTER_PUSH" },
        { EVENT_INITIALIZE,             "INITIALIZE" },
        { EVENT_DATA,                   "DATA" },

        
        { EVENT_KEY_PRESS,              "KEY_PRESS" },
        { EVENT_KEY_UP,                 "KEY_UP" },
        { EVENT_KEY_DOWN,               "KEY_DOWN" },
        { EVENT_POINTER_UP,             "POINTER_UP" },
        { EVENT_POINTER_DOWN,           "POINTER_DOWN" },
        { EVENT_POINTER_MOVE,           "POINTER_MOVE" },
        { EVENT_UNLOAD,                 "UNLOAD" },
        { EVENT_ENTER_FRAME,            "ENTER_FRAME" },
        { EVENT_POINTER_DRAG_LEAVE,     "DRAG_LEAVE" },

        
        { EVENT_COND_MENU_ENTER,        "MENU_ENTER" },
        { EVENT_COND_MENU_LEAVE,        "MENU_LEAVE" }
}
This array defines the names of events and the corresponding bit.

The names are compared case insensitively, but the underscore has to be just that and not a space. Change your user string before a call to StringToEvents(const char *s) if you want to allow your users to type a space.

See also:
sswf::Event::StringToEvents(const char *s)

Referenced by StringToEvents().

Initial value:

 {
        { KEY_CODE_LEFT_ARROW,  "LEFT_ARROW" },
        { KEY_CODE_RIGHT_ARROW, "RIGHT_ARROW" },
        { KEY_CODE_HOME,        "HOME" },
        { KEY_CODE_END,         "END" },
        { KEY_CODE_INSERT,      "INSERT" },
        { KEY_CODE_DELETE,      "DELETE" },
        { KEY_CODE_BACKSPACE,   "BACKSPACE" },
        { KEY_CODE_ENTER,       "ENTER" },
        { KEY_CODE_UP_ARROW,    "UP_ARROW" },
        { KEY_CODE_DOWN_ARROW,  "DOWN_ARROW" },
        { KEY_CODE_PAGE_UP,     "PAGE_UP" },
        { KEY_CODE_PAGE_DOWN,   "PAGE_DOWN" },
        { KEY_CODE_TAB,         "TAB" },
        { KEY_CODE_ESCAPE,      "ESCAPE" },
        { KEY_CODE_SPACE,       "SPACE" }
}
This array lists the special keys with their SWF code and their name. See the function StringToKeyCode(const char *s) for more information.

The names are compared case insensitively, but the underscore (_) must be an underscore. If you want to let your users enter a space instead, change the string before a call to the function.

See also:
sswf::Event::StringToKeyCode(const char *s)

Referenced by StringToKeyCode().


The documentation for this class was generated from the following files:


Generated on Wed Mar 18 15:13:58 2009 for libsswf by  doxygen 1.5.5