libsswf: sswf::ActionSetTarget Class Reference

# sswf::ActionSetTarget Class Reference

This class is used to define the sprite on which the actions apply. More...

`#include <libsswf.h>`

Inheritance diagram for sswf::ActionSetTarget:

List of all members.

## Public Member Functions
| ActionSetTarget (TagBase *tag)
| Initializes the ActionSetTarget.
void | SetTarget (const char *target)
| Set the name of the Sprite to affect.
## Private Member Functions
virtual Action * | Duplicate (void) const
| Create a duplicate of this action.
virtual ErrorManager::error_code_t | ParseData (const Data &data)
| Parse the data of the ActionSetTarget.
virtual ErrorManager::error_code_t | SaveData (Data &data, Data &nested_data)
| Save the extra data of the ActionSetTarget.
## Private Attributes
char * | f_target

## Detailed Description

Before becoming fully object oriented, ActionScript used this action to define the name of the Sprite on which the actions had an effect.

Using an empty name would reset the ActionScript to its default behavior.

See also:
  SWF Alexis' Reference—Set Target

  SWF Alexis' Reference—Set Target (dynamic)

## Constructor & Destructor Documentation

ActionSetTarget::ActionSetTarget | ( | TagBase * | tag | ) |

By default, the constructor creates an action target with no name (i.e. reset to normal default behavior).

Use the sswf::ActionSetTarget::SetTarget() function to define which sprite should be affected.

Parameters:

  `[in]` | tag | The tag in which this action is saved.

References f_target.

Referenced by Duplicate().

## Member Function Documentation

Action * ActionSetTarget::Duplicate | ( | void |  | ) | const`[private, virtual]`

This function creates a new ActionSetTarget and copy the target name of 'this' SetTarget and return the result.

Returns:
  The pointer to the new ActionSetTarget

Reimplemented from sswf::Action.

References ActionSetTarget(), f_target, SetTarget(), and sswf::Action::Tag().

ErrorManager::error_code_t ActionSetTarget::ParseData | ( | const Data & | data | ) | `[private, virtual]`

This function retrieves the name of the target as expected by this action.

Parameters:

  `[in]` | data | The Data buffer where the target name is read from

Returns:
  An error code or ERROR_CODE_NONE

Reimplemented from sswf::Action.

References f_target, and sswf::Data::GetString().

ErrorManager::error_code_t ActionSetTarget::SaveData | ( | Data & | data,
|  | Data & | nested_data |
| ) |  |  | `[private, virtual]`

This function saves the name of the target as expected by this action.

Parameters:

  `[in]` | data | The Data buffer where the target name is saved
  `[in]` | nested_data | The ActionSetTarget has no nested data

Returns:
  An error code or ERROR_CODE_NONE

Reimplemented from sswf::Action.

References f_target, and sswf::Action::SaveString().

void ActionSetTarget::SetTarget | ( | const char * | target | ) |

This function should be called with the name of the Sprite which needs to be affected by the following actions.

Set the name to NULL or an empty string to cancel a previous ActionSetTarget (this is the default so you do not have to do so.)

References f_target, sswf::MemoryManager::MemFree(), and sswf::MemoryManager::StrDup().

Referenced by Duplicate().

## Member Data Documentation

char* sswf::ActionSetTarget::f_target`[private]`

Referenced by ActionSetTarget(), Duplicate(), ParseData(), SaveData(), and SetTarget().

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

- libsswf.h
- libsswf_actions.c++