#include <libsswf.h>
Public Types | |
enum | action_t { ACTION_UNKNOWN = -1, ACTION_LABEL = -2, ACTION_min = 0x00, ACTION_END = 0x00, ACTION_NEXT_FRAME = 0x04, ACTION_PREVIOUS_FRAME = 0x05, ACTION_PLAY = 0x06, ACTION_STOP = 0x07, ACTION_TOGGLE_QUALITY = 0x08, ACTION_STOP_SOUND = 0x09, ACTION_ADD = 0x0A, ACTION_SUBTRACT = 0x0B, ACTION_MULTIPLY = 0x0C, ACTION_DIVIDE = 0x0D, ACTION_EQUAL = 0x0E, ACTION_LESS_THAN = 0x0F, ACTION_LOGICAL_AND = 0x10, ACTION_LOGICAL_OR = 0x11, ACTION_LOGICAL_NOT = 0x12, ACTION_STRING_EQUAL = 0x13, ACTION_STRING_LENGTH = 0x14, ACTION_SUB_STRING = 0x15, ACTION_POP = 0x17, ACTION_INTEGRAL_PART = 0x18, ACTION_GET_VARIABLE = 0x1C, ACTION_SET_VARIABLE = 0x1D, ACTION_SET_TARGET2 = 0x20, ACTION_CONCATENATE = 0x21, ACTION_GET_PROPERTY = 0x22, ACTION_SET_PROPERTY = 0x23, ACTION_DUPLICATE_SPRITE = 0x24, ACTION_REMOVE_SPRITE = 0x25, ACTION_TRACE = 0x26, ACTION_START_DRAG = 0x27, ACTION_STOP_DRAG = 0x28, ACTION_STRING_LESS_THAN = 0x29, ACTION_THROW = 0x2A, ACTION_CAST_OBJECT = 0x2B, ACTION_IMPLEMENTS = 0x2C, ACTION_FSCOMMAND2 = 0x2D, ACTION_RANDOM = 0x30, ACTION_MBSTRING_LENGTH = 0x31, ACTION_ORD = 0x32, ACTION_CHR = 0x33, ACTION_GET_TIMER = 0x34, ACTION_SUB_MBSTRING = 0x35, ACTION_MBORD = 0x36, ACTION_MBCHR = 0x37, ACTION_DELETE = 0x3A, ACTION_SET_LOCAL_VAR = 0x3C, ACTION_SET_LOCAL_VARIABLE = 0x3C, ACTION_CALL_FUNCTION = 0x3D, ACTION_RETURN = 0x3E, ACTION_MODULO = 0x3F, ACTION_NEW = 0x40, ACTION_DECLARE_LOCAL_VAR = 0x41, ACTION_DECLARE_LOCAL_VARIABLE = 0x41, ACTION_DECLARE_ARRAY = 0x42, ACTION_DECLARE_OBJECT = 0x43, ACTION_TYPE_OF = 0x44, ACTION_GET_TARGET = 0x45, ACTION_ENUMERATE = 0x46, ACTION_ADD_TYPED = 0x47, ACTION_LESS_THAN_TYPED = 0x48, ACTION_EQUAL_TYPED = 0x49, ACTION_NUMBER = 0x4A, ACTION_STRING = 0x4B, ACTION_DUPLICATE = 0x4C, ACTION_SWAP = 0x4D, ACTION_GET_MEMBER = 0x4E, ACTION_SET_MEMBER = 0x4F, ACTION_INCREMENT = 0x50, ACTION_DECREMENT = 0x51, ACTION_CALL_METHOD = 0x52, ACTION_NEW_METHOD = 0x53, ACTION_INSTANCE_OF = 0x54, ACTION_ENUMERATE_OBJECT = 0x55, ACTION_AND = 0x60, ACTION_OR = 0x61, ACTION_XOR = 0x62, ACTION_SHIFT_LEFT = 0x63, ACTION_SHIFT_RIGHT = 0x64, ACTION_SHIFT_RIGHT_UNSIGNED = 0x65, ACTION_STRICT_EQUAL = 0x66, ACTION_GREATER_THAN_TYPED = 0x67, ACTION_STRING_GREATER_THAN = 0x68, ACTION_EXTENDS = 0x69, ACTION_GOTO_FRAME = 0x81, ACTION_URL = 0x83, ACTION_STORE_REGISTER = 0x87, ACTION_DECLARE_DICTIONARY = 0x88, ACTION_STRICT_MODE = 0x89, ACTION_WAIT_FOR_FRAME = 0x8A, ACTION_SET_TARGET = 0x8B, ACTION_GOTO_LABEL = 0x8C, ACTION_WAIT_FOR_FRAME2 = 0x8D, ACTION_DECLARE_FUNCTION2 = 0x8E, ACTION_TRY = 0x8F, ACTION_WITH = 0x94, ACTION_PUSH_DATA = 0x96, ACTION_BRANCH_ALWAYS = 0x99, ACTION_URL2 = 0x9A, ACTION_DECLARE_FUNCTION = 0x9B, ACTION_BRANCH_IF_TRUE = 0x9D, ACTION_CALL_FRAME = 0x9E, ACTION_GOTO_EXPRESSION = 0x9F, ACTION_max = 0xFF } |
List all the actions supported by SSWF. More... | |
Public Member Functions | |
Action (TagBase *tag, action_t action) | |
Initialize an action. | |
virtual Action * | Duplicate (void) const |
Create a clone of 'this' Action. | |
TagBase * | GetTag (void) const |
unsigned long | Offset (void) const |
Retrieve the offset position of this action. | |
ErrorManager::error_code_t | OnError (ErrorManager::error_code_t errcode, const char *message,...) const |
Send an error to the error manager. | |
ErrorManager::error_code_t | Save (Data &data) |
Save the action in a Data buffer. | |
ErrorManager::error_code_t | SaveList (const Vectors *list, Data &data, const Vectors *extra=0) |
Save a list of actions in a Data buffer. | |
virtual Vectors * | SubList (void) |
Query for the Vectors of sub-actions. | |
virtual unsigned char | Version (void) const |
Retrieve the minimum version required for this action. | |
virtual | ~Action () |
Clean up the action. | |
Static Public Member Functions | |
static ActionLabel * | FindLabel (const Vectors &list, const char *label) |
Search for a label within a list of actions. | |
static ActionLabel * | FindLabelAtOffset (Vectors &list, unsigned long offset) |
Search for an action with the specified offset. | |
static int | GetMaximumRegister (const Vectors &list) |
Retrieve the largest register number used. | |
static int | MinimumListVersion (const Vectors &list) |
Retrive the minimum version required to use this list of actions. | |
static ErrorManager::error_code_t | Parse (TagBase *tag, const Data &data, Vectors &actions) |
Parse the data buffer for the next action. | |
static ErrorManager::error_code_t | ParseList (TagBase *tag, const Data &data, Vectors &actions) |
Parse all the actions defined in the Data buffer. | |
Protected Member Functions | |
virtual int | GetMaxRegister (void) const |
Retrieve the largest register used by this action. | |
virtual ErrorManager::error_code_t | Parse2ndPass (Vectors &list) |
Second pass after a load to fix branches. | |
virtual ErrorManager::error_code_t | ParseData (const Data &data) |
Load extraneous data. | |
virtual ErrorManager::error_code_t | Save2ndPass (const Vectors &list, Data &data) |
Last chance for an action to save itself right. | |
virtual ErrorManager::error_code_t | SaveData (Data &data, Data &nested_data) |
Save extraneous data. | |
ErrorManager::error_code_t | SaveString (Data &data, const char *string) |
Save a string in a way compatible to the actions. | |
TagBase * | Tag (void) const |
Get the tag in which this action resides. | |
Protected Attributes | |
const action_t | f_action |
This action code (ACTION_...). | |
unsigned long | f_offset |
The byte position of this action in its list. | |
Private Attributes | |
unsigned char | f_min_version |
TagBase * | f_tag |
The Action class represents one SWF raw action (i.e. no JavaScript!)
The organization of actions to create a valid script is described in my Alexis' SWF Reference—Do Action document.
Actions are ItemBase objects which can thus be added in a Vectors array. Tags which support actions will usually expose the vector used to save actions in it. Also, some actions can have sub-actions. Similarly, you have the sswf::Action::SubList(void) function which can be used to retrieve the sub-actions of a given action.
Note that newer action script code is much different from the old one. This applies to movies version 9 or better when setup to run ActionScript version 3 (see the abcFormat.html document.)
These action enumeration variables are used whenever you create an action object. All the actions which do not require any data are created using the Action object. In this case you must specify the action enumeration variable.
Actions which require some additional data will automatically receive a default (i.e. sswf::ActionBranch is set to ACTION_BRANCH_ALWAYS by default.) Some cannot actually be changed by you (i.e. sswf::ActionCallFrame). All of them can only receive a very few set of values. Trying to set another value will generate an error on creation.
ACTION_UNKNOWN |
The special unknown value.
This special action number can be used to mark an entry as unknown. You cannot create and save an unknown action in an SWF file.
|
ACTION_LABEL |
A label to branch to.
This special action repesents a label. A specific object must be created to use an ACTION_LABEL the sswf::ActionLabel object. You should name labels and then use their name with sswf::ActionBranch to jump to the instructions appearing after that label. It is legal to create multiple labels one after another without adding other instructions in between, in effect creating one label and aliases.
|
ACTION_min |
Very first valid action.
The ACTION_min value represents the smallest valid action which can be saved in an SWF file.
|
ACTION_END |
End the current list of actions.
The ACTION_END is for programs execution what the '\0' is for C string: it represents the end of actions. It is in general not necessary for your to add this action as the system takes care of that for you automatically. It usually makes it simpler not to add the ACTION_END actions. Note that this is used once to end the entire list of actions. Actions within a function or other groups of actions are not terminated by an ACTION_END. Instead they have a size in bytes to skip their body and at the same time determine the end of actions to execute as required.
|
ACTION_NEXT_FRAME |
Skip the next Show Frame.
The ACTION_NEXT_FRAME is useful whenever you stop the playback and thus the program pointer remains within one frame. This action forces the animation to move to the next frame and display it.
|
ACTION_PREVIOUS_FRAME |
Jump back one frame; before the previous ShowFrame.
The ACTION_PREVIOUS_FRAME is useful whenever you stop the playback and thus the program pointer remains within one frame. This action forces the animation to move to the previous frame and display it.
|
ACTION_PLAY |
Start playing the animation.
The ACTION_PLAY restart the playback of an animation. It is possible stop an animation with ACTION_STOP. The last of ACTION_PLAY or ACTION_STOP encountered in a frame is the one in effect.
|
ACTION_STOP |
Start playing the animation.
The ACTION_STOP stops the playback of an animation. It is possible restart an animation with ACTION_PLAY. The last of ACTION_PLAY or ACTION_STOP encountered in a frame is the one in effect. When a movie is marked as stopped, its current frame is displayed but no script is played. To restart the animation, you either have a button or another thread (i.e. a sprite) still running. Each sprite has its own loop and thus they can be considered threads thought each one's script will be executed serially.
|
ACTION_TOGGLE_QUALITY |
Switch between low and high quality rendering.
The ACTION_TOGGLE_QUALITY is used to switch between the different quality modes available. In general, you shouldn't do that. However, if you detect that the realtime frame rate is much lower than it should be, you can request the quality to drop in order to increase the frame rate to reasonable levels. This tag should not be used anymore since you cannot know exactly what you are doing without first querying for the quality. Instead you can use a function call.
|
ACTION_STOP_SOUND |
Stop play sounds.
The ACTION_STOP_SOUND requests that the player stops playing any sound in the current movie. This means used in a sprite, it stops the sounds of that sprite and not the entire animation.
|
ACTION_ADD |
Add two values on the stack.
The ACTION_ADD pops two values from the stack, add them together and pushes the result back onto the stack.
|
ACTION_SUBTRACT |
Subtract two values on the stack.
The ACTION_SUBTRACT pops two values from the stack, subtract one from the other and pushes the result back onto the stack.
|
ACTION_MULTIPLY |
Multiply two values on the stack.
The ACTION_MULTIPLY pops two values from the stack, multiply them together and pushes the result back onto the stack.
|
ACTION_DIVIDE |
Divide two values on the stack.
The ACTION_DIVIDE pops two values from the stack, divide one by the other and pushes the result back onto the stack.
|
ACTION_EQUAL |
Test whether two objects are equal.
The ACTION_EQUAL pops two values from the stack, compare them for equality and pushes the result back on the stack. There is not action not equal. Instead you need to use this action and an ACTION_LOGICAL_NOT.
|
ACTION_LESS_THAN |
Test whether two objects are ordered.
The ACTION_LESS_THAN pops two values from the stack, compare them for order and pushes the result back on the stack.
Note that in older versions you only had a
|
ACTION_LOGICAL_AND |
Test whether two objects are true.
The ACTION_LOGICAL_AND pops two values from the stack, casts them to a boolean value, computes the result (if both values are true, then the result is true, otherwise it is false) and pushes the result back on the stack.
|
ACTION_LOGICAL_OR |
Combines two boolean value with an OR.
The ACTION_LOGICAL_OR pops two values from the stack, cast them to boolean values, compute a logical or (i.e. if at least one value is true, use true otherwise use false) and pushes the result back on the stack.
|
ACTION_LOGICAL_NOT |
Apply a logical not to the value on the stack.
The ACTION_LOGICAL_NOT pops one object from the stack, cast it to a boolean value if necessary, then pushes This action is particularly useful when branching since SWF only supports a branch if true action (i.e. no branch if false action!)
|
ACTION_STRING_EQUAL |
Test whether two strings are equal.
The ACTION_STRING_EQUAL pops two strings from the stack, compare them for equality and pushes the result back on the stack. This action will ensure that two strings which represent numbers are still compared as strings and not numbers.
|
ACTION_STRING_LENGTH |
Compute the length of a string in characters.
The ACTION_STRING_LENGTH pops one string, counts the number of characters and pushes the result back on the stack.
|
ACTION_SUB_STRING |
Retrieve part of a string.
The ACTION_SUB_STRING pops one string and two numbers: one position and one length; then it generates a new string from the sub-string starting at that position and for that many characters; this is the result which is pushed backed on the stack.
|
ACTION_POP |
Pop one element from the stack.
The ACTION_POP action is used to forget about the result of a function call.
|
ACTION_INTEGRAL_PART |
Remove the fractional part of a float.
The ACTION_INTEGRAL_PART action is used on a floating point to remove the fractional part. This action does not round the input. It only removes the fractional part. To get a rounding effect, add 0.5 to the float first. This is the equivalent of the floor() function in the C/C++ math library. One can use the modulo action with 1.0 to extract the fractional part.
|
ACTION_GET_VARIABLE |
Read a variable.
The ACTION_GET_VARIABLE action reads the content of a variable and puts it on the stack. The name of the variable is taken from the stack. The name can be a full path.
|
ACTION_SET_VARIABLE |
Read a variable.
The ACTION_SET_VARIABLE action reads the content of a variable and puts it on the stack. The new value for the variable is pop first from the stack, then the name of the variable. The name can be a full path.
|
ACTION_SET_TARGET2 |
Set an object as current.
The ACTION_SET_TARGET2 action retreives one string from the stack. The string must be either the empty string (to cancel a previous set target) or the name of an existing object (sprite, movie). Actions such as ACTION_SET_PROPERTY and ACTION_GET_PROPERTY following a set target apply to the current object. In other words, when an empty string is specified, the actions apply to the main object, otherwise to the specified object.
|
ACTION_CONCATENATE |
Concatenate two strings together.
The ACTION_CONCATENATE action retrieves two strings from the stack, concatenate them together and push the result back on the stack.
If one of the input is not a string, the Newer versions should make use of the ACTION_ADD_TYPED instead. The add will concatenate strings properly as expected unless both operands are numbers in which case the usual addition is applied.
|
ACTION_GET_PROPERTY |
Read from an object property.
The ACTION_GET_PROPERTY action reads the content of the specified property of the specified object (sprite, movie) and puts it on the stack. The name of the property is taken from the stack as a number. The name of a property is represented by a number. The number can be either an integer or a floating point, though it has been a rule to use floating points. In general, this is used by a compiler as an optimization. Otherwise, it is recommended to use the ACTION_GET_MEMBER with the name of the property in a string. Some of these numeric properties may be removed in future versions of SWF.
|
ACTION_SET_PROPERTY |
Write to an object property.
The ACTION_SET_PROPERTY action gets the new property value, the name of the property (as a number) and the name of the object (as a string) from the stack and saves the new property value in that object property. The name of a property is represented by a number. The number can be either an integer or a floating point, though it has been a rule to use floating points. In general, this is used by a compiler as an optimization. Otherwise, it is recommended to use the ACTION_SET_MEMBER with the name of the property in a string. Some of these numeric properties may be removed in future versions of SWF.
|
ACTION_DUPLICATE_SPRITE |
Create a new sprite from an existing sprite.
The ACTION_DUPLICATE_SPRITE action creates a duplicate of an existing sprite. The new way to do so is to use the ACTION_NEW which represents the ActionScript new operator. The new operator is somewhat different since it will also call the constructor, though some people may still want to use this action instead.
|
ACTION_REMOVE_SPRITE |
Remove an existing sprite from the display list.
The ACTION_REMOVE_SPRITE action searches for the specified sprite and remove it from the display list. Once removed, the sprite is also deleted and cannot be reused. This action should be used whenever a sprite was created with the ACTION_DUPLICATE_SPRITE. Objects created with the ACTION_NEW operator need to be deleted with the ACTION_DELETE operator.
|
ACTION_TRACE |
Turn on TRACE mode.
This is a Macromedia Flash internal action caught by the debugger. Whenever encountered, it starts tracing the execution of your code. In the player, it has no effect.
|
ACTION_START_DRAG |
Start dragging an object.
This action has the effect of attaching an object to the user's mouse. The following movements of the mouse will move the object until the ACTION_STOP_DRAG is used. This action is often executed after an sswf::Event::EVENT_POINTER_DOWN.
|
ACTION_STOP_DRAG |
Stop dragging the dragged object.
This action must be called once the drag action is over. This breaks the effect of having an object follow the user's mouse all over the place. This action is often executed after an sswf::Event::EVENT_POINTER_UP.
|
ACTION_STRING_LESS_THAN |
Test whether two strings are ordered.
The ACTION_STRING_LESS_THAN pops two strings from the stack, compare them for order and pushes the result back on the stack. This action will ensure that two strings which represent numbers are still compared as strings and not numbers.
|
ACTION_THROW |
Throw an exception.
The ACTION_THROW pops one element from the stack and generates an exception of that type. One can use a try/catch/finaly block to manage exceptions.
|
ACTION_CAST_OBJECT |
Cast from one type to another.
The ACTION_CAST_OBJECT action transform an object reference from one time to another. Really, in Javascript, this means making sure that an object is of a specified type. If not, you get NULL. Otherwise the action has no effect. This is similar to sswf::Action::ACTION_INSTANCE_OF except that it returns a reference to the object instead of a boolean value which often is more practical.
|
ACTION_IMPLEMENTS |
Define a list of interfaces that an object implements.
The ACTION_IMPLEMENTS is used to mark an object as a derivation of one or more objects. These other objects are expected to be interfaces. This means they should only define abstract functions.
|
ACTION_FSCOMMAND2 |
Dynamic "Foreign Script Command".
The ACTION_FSCOMMAND2 action pops an integer which is the number of strings to pop next. The first string popped is the name of the command to execute and the following strings are its parameters. FS in this action name means Foreign Script. In other words, not an ActionScript command, but a javascript command from within the browser. In order to execute dynamic ActionScript code, use the eval() function instead. Note that the SWF implementation of eval() is quite limited. So don't expect too much out of it.
|
ACTION_RANDOM |
Generates a random value.
The ACTION_RANDOM action pops one number from the stack and generates a random value between 0 and that number (the number not included.) The random value is not very good in older SWF players. It is suggested you use the Math.Random() function instead, which returns a value between 0.0 and 1.0.
|
ACTION_MBSTRING_LENGTH |
Compute the length of a UTF-8 string in characters.
The ACTION_MBSTRING_LENGTH pops one string, counts the number of characters and pushes the result back on the stack. The string is assumed to be defined in UTF-8.
|
ACTION_ORD |
Transform a character in the corresponding integer.
The ACTION_ORD action pops one string and transform the first character in a number and push that number on the stack. This action can only deal with ASCII strings. Use the sswf::Action::ACTION_MBORD for international strings.
|
ACTION_CHR |
Transform a number in the corresponding character.
The ACTION_CHR action pops one number and transform it in a character, then it pushes a string composed of that character on the stack. This action can only deal with ASCII characters. Use the sswf::Action::ACTION_MBCHR for international characters.
|
ACTION_GET_TIMER |
Push the current frame number on the stack.
The ACTION_GET_TIMER action gets the frame counter and push it on the stack. This is the main frame counter for the main SWF movie. In the newer versions of SWF you have access to a similar function on each movie (I think it is called GetFrame(), but I'd have to verify...)
|
ACTION_SUB_MBSTRING |
Retrieve part of a string.
The ACTION_SUB_MBSTRING pops one string and two numbers: one position and one length; then it generates a new string from the sub-string starting at that position and for that many characters; this is the result which is pushed backed on the stack. This action views the input string as a UTF-8 encoded string.
|
ACTION_MBORD |
Transform a character in the corresponding integer.
The ACTION_MBORD action pops one string and transform the first character in a number and push that number on the stack. This action deals with any character (yet SWF is limited to 16 bits characters or UCS-2).
|
ACTION_MBCHR |
Transform a number in the corresponding character.
The ACTION_MBCHR action pops one number and transform it in a character, then it pushes a string composed of that character on the stack. This action can deal with any international characters (yet SWF is limited to 16 bits characters or UCS-2.)
|
ACTION_DELETE |
Delete an object.
The ACTION_DELETE action pops an object and a string to delete a property in an object. Note that an object does not need to be deleted. If all references to that object disappear, then the object is automatically deleted. It is possible to delete a global variable by pushing undefined on the stack instead of an object.
|
ACTION_SET_LOCAL_VAR |
Same as sswf::Action::ACTION_SET_LOCAL_VARIABLE.
|
ACTION_SET_LOCAL_VARIABLE |
Set a variable local to the function being executed.
When running within a function, it is possible to create a variable within this function. This is very useful to avoid clashes between variable names between the different functions you write. To get a local variable, use the sswf::Action::ACTION_GET_VARIABLE action. See also the sswf::Action::ACTION_DECLARE_LOCAL_VARIABLE.
|
ACTION_CALL_FUNCTION |
Call a global function.
This action is used to call a global or internal function. This action cannot be used to call a function on an object. Use the sswf::Action::ACTION_CALL_METHOD instead. When a function returns, something will be on the stack. A function declared as void in ActionScript usually return an undefined entry. Just use sswf::Action::ACTION_POP to get rid of it. See the sswf::Action::ACTION_RETURN to see how you can return right away from a function. The older versions (at least up to version 6) would return as many things as you were pushing on the stack. I suggest you make sure only one object is returned from your functions!
|
ACTION_RETURN |
End a function execution and return.
The ACTION_RETURN ends a function execution. Whatever was last pushed on the stack is what the function returns. In older versions (up to version 6 at least), the stack was not purged meaning that you could return multiple objects on the stack. This is supposedly fixed, but I did not test to confirm whether this is really the case. So be careful and make sure that you have only one object on the stack or expect the unexpected!
|
ACTION_MODULO |
Modulo of two values on the stack.
The ACTION_MODULO pops two values from the stack, divide one by the other and pushes the rest back onto the stack. Use this action with 1.0 to retrieve the fractional part of a floating point value.
|
ACTION_NEW |
Create a new instance of an object.
The ACTION_NEW creates a new instance of an object. The name of the class and the parameters used to call the constructor are taken from the stack. The constructor result will be discarded. The result of the ACTION_NEW is the newly created object which in general will be saved in a variable or a variable member (also called property.) To delete the object, remove all instances by deleting or reassigning the variables holding the object. To call an overloaded new constructor, you need to use the sswf::Action::ACTION_NEW_METHOD action instead.
|
ACTION_DECLARE_LOCAL_VAR |
Same as sswf::Action::ACTION_DECLARE_LOCAL_VARIABLE.
|
ACTION_DECLARE_LOCAL_VARIABLE |
Declare names to be used for local variables.
The ACTION_DECLARE_LOCAL_VARIABLE action takes an array of strings naming all the variables that will be created in this function and need to be created locally (i.e. not visible outside of this function.) After this function, a regular sswf::Action::ACTION_SET_VARIABLE will set a local variable if its name was specified in the list of this ACTION_DECLARE_LOCAL_VARIABLE array. This action has the side effect of setting the corresponding variable to undefined. This hides any corresponding global variables in case you try to get the variable before setting it.
|
ACTION_DECLARE_ARRAY |
Declare an array.
The ACTION_DECLARE_ARRAY action creates an array object and save the result on the stack. This action pops one number from the stack which is the number of values pushed on the stack which will be used to initialize the array. These values are then assigned to the array starting at index 0. A counter of 0 means only one value is to be assigned. A counter of 1 means 2 values are to be assigned. Etc. To initialize an array sporadically, use the sswf::Action::ACTION_DECLARE_OBJECT instead.
|
ACTION_DECLARE_OBJECT |
Declare an object and its properties.
The ACTION_DECLARE_OBJECT action creates an object and save the result on the stack. This action pops the name of the new object and the number of members defined on the stack. The stack holds the name and the value of each pre-defined member. The value of a member can be a function (when a function is declared without a name, it is stacked!) Thus, in effect, you can declare methods! It is possible to create an array with the ACTION_DECLARE_OBJECT by specifying the indices as the variable member names. In this case, you can initializes an array sporadically.
|
ACTION_TYPE_OF |
Determine the type of the data on the stack.
The ACTION_TYPE_OF action pops one object from the stack, determines its type, and push the name of the type back on the stack as a string. It is suggested to use one of sswf::Action::ACTION_CAST_OBJECT or sswf::Action::ACTION_INSTANCE_OF isntead. If you need to keep the data also, use the sswf::Action::ACTION_DUPLICATE first. The possible types are:
number boolean string object movieclip null undefined function
|
ACTION_GET_TARGET |
Make this object the target.
Get the path to the specified sprite and make it the target (as with sswf::Action::ACTION_SET_TARGET2.) This function lets you specify a sprite instead of a path which may be difficult to determine in some circumstances.
|
ACTION_ENUMERATE |
Enumerate an object or an array.
The ACTION_ENUMERATE action pops an object, stack a NULL and then stacks the object member names and corresponding values. This can be used with either an object or an array. In case of an array, the indices replace the member names. Unfortunately, what is being enumerated cannot as is be used to create a new object since there is no way to know how many entries have been enumerated without first going through the entire stack! Otherwise, the stack looks like what the sswf::Action::ACTION_DECLARE_OBJECT accepts as parameters.
|
ACTION_ADD_TYPED |
Add according to the operand types.
The ACTION_ADD_TYPED action pops two objects and add them according to their type. If both variables are strings, concatenate them. If one of the variables is a floating point, convert the other to a floating point if not already a floating point, then add them and put the addition result back on the stack. If both are integers, add them and put the result back on the stack. This is the prefered way to convert the + operator of ActionScript since it follows the ECMA specification.
|
ACTION_LESS_THAN_TYPED |
Compare according to the operand types.
The ACTION_LESS_THAN_TYPED action pops two objects and compare them according to their type. This is the prefered way to convert the < operator of ActionScript since it follows the ECMA specification.
|
ACTION_EQUAL_TYPED |
Compare according to the operand types.
The ACTION_EQUAL_TYPED action pops two objects and compare them according to their type. This is the prefered way to convert the == operator of ActionScript since it follows the ECMA specification.
|
ACTION_NUMBER |
Converts an object to a number.
The ACTION_NUMBER action calls the method valueOf() of the object on the stack and replaces that object with a number. If the operation fails, undefined is pushed on the stack. This is a good way to optimize a call to the valueOf() method of any object. Also, it works on internal types.
|
ACTION_STRING |
Converts an object to a string.
The ACTION_STRING action calls the method toString() of the object on the stack and replaces that object with a string representing the object. If the operation fails, undefined is pushed on the stack. This is a good way to optimize a call to the toString() method of any object. Also, it works on internal types.
|
ACTION_DUPLICATE |
Duplicate one element on the stack.
The ACTION_DUPLICATE action pops one element from the stack and pushes it back twice.
|
ACTION_SWAP |
Swap the two last elements on the stack.
The ACTION_SWAP action pops two elements from the stack and push them back the other way around.
|
ACTION_GET_MEMBER |
Read the value of an object member.
The ACTION_GET_MEMBER action is similar to the sswf::Action::ACTION_GET_VARIABLE but looks within an object for the variable definition and content. The value of a member can be a function as well as a value. The member name can be an index when accessing an array. This action replaces the sswf::Action::ACTION_GET_PROPERTY which used a number to access a set of predefined member names.
|
ACTION_SET_MEMBER |
Write the value of an object member.
The ACTION_SET_MEMBER action is similar to the sswf::Action::ACTION_SET_VARIABLE but creates the variable inside an object and that is called a member. The value of a member can be a function as well as a value. In case it is a function, it can then be called with the sswf::Action::ACTION_CALL_METHOD action. The member name can be an index when accessing an array. To get rid of a member, use the sswf::Action::ACTION_DELETE action. This action replaces the sswf::Action::ACTION_SET_PROPERTY which used a number to access a set of predefined member names.
|
ACTION_INCREMENT |
Add 1 to the value at the top of the stack.
The ACTION_INCREMENT action adds one to the value on the stack. The stack is expected to be an integer or a floating point value. Another object will be converted to a number if possible.
|
ACTION_DECREMENT |
Subtract 1 from the value at the top of the stack.
The ACTION_DECREMENT action subtracts one to the value on the stack. The stack is expected to be an integer or a floating point value. Another object will be converted to a number if possible.
|
ACTION_CALL_METHOD |
Call a method on an object.
The ACTION_CALL_METHOD action calls the named method of an object with the specified parameters. This is similar to the sswf::Action::ACTION_CALL_FUNCTION but it calls the function defined within an object instead. This means that the 'this' parameter will be defined in that function and it can be used to access the members of the object. A call always returns a value. If the method is declared as a function returning void (a procedure in effect), the function returns undefined.
|
ACTION_NEW_METHOD |
Create an object and call a constructor.
The ACTION_NEW_METHOD action creates a new instance of an object and then initializes it by calling a constructor depending on its parameters (constructors can be overloaded in this case.) This is similar to the ACTION_NEW except that the proper overloaded constructor is called automatically.
|
ACTION_INSTANCE_OF |
Check wether an object of an instance of a specified class.
The ACTION_INSTANCE_OF action checks whether a given object was created from a given class. Since everything in SWF is an object (including a classes, interfaces, etc.), I'm not too sure how this works. I suppose they can keep a link to the original object used to create another and each object has a set of inheritance in case of multiple inheritance (which should only happen with interfaces.)
|
ACTION_ENUMERATE_OBJECT |
Enumerate an object or an array.
The ACTION_ENUMERATE_OBJECT action pops an object, stacks a NULL and then stacks the object member names on the stack. This can be used with either an object or an array. In case of an array, the indices replace the member names.
|
ACTION_AND |
Apply a bitwise AND between two numbers.
The ACTION_AND action applies a bitwise AND between two integer numbers. The SWF player does not support bitwise AND between floating points. This is the & operator in ActionScript.
|
ACTION_OR |
Apply a bitwise OR between two numbers.
The ACTION_OR action applies a bitwise OR between two integer numbers. The SWF player does not support bitwise OR between floating points. This is the | operator in ActionScript.
|
ACTION_XOR |
Apply a bitwise XOR between two numbers.
The ACTION_XOR action applies a bitwise XOR between two integer numbers. The SWF player does not support bitwise XOR between floating points. This is the ^ operator in ActionScript.
|
ACTION_SHIFT_LEFT |
Shift bits to the left.
The ACTION_SHIFT_LEFT action shifts the bits of an integer to the left. The SWF player does not support shifting floating points. This is the << operator in ActionScript.
|
ACTION_SHIFT_RIGHT |
Shift bits to the right.
The ACTION_SHIFT_RIGHT action shifts the bits of an integer to the right. The integer is taken as a signed integer. This means that a negative integer remains negative and a positive integer remains positive. The SWF player does not support shifting floating points. This is the >> operator in ActionScript.
|
ACTION_SHIFT_RIGHT_UNSIGNED |
Shift bits to the right.
The ACTION_SHIFT_RIGHT_UNSIGNED action shifts the bits of an integer to the right. The integer is taken as an unsigned integer. This means that the most significant bits are cleared as the value is being shifted. The SWF player does not support shifting floating points. This is the >>> operator in ActionScript.
|
ACTION_STRICT_EQUAL |
Compare two objects without conversions.
The ACTION_STRICT_EQUAL compare two objects without trying to convert one or the other so they match. For instance, 0 == "0" is considered true, but 0 === "0" is not. This action represents the === operation of ActionScript.
|
ACTION_GREATER_THAN_TYPED |
Compare according to the operand types.
The ACTION_GREATER_THAN_TYPED action pops two objects and compare them according to their type. This is the prefered way to convert the > operator of ActionScript since it follows the ECMA specification.
|
ACTION_STRING_GREATER_THAN |
Test whether two strings are ordered.
The ACTION_STRING_GREATER_THAN pops two strings from the stack, compare them for order and pushes the result back on the stack. This action will ensure that two strings which represent numbers are still compared as strings and not numbers.
|
ACTION_EXTENDS |
Mark a class as the extension of another.
The ACTION_EXTENDS action is used to define the inheritance of a class. It is used to implement the ActionScript:
class A { ...}; class B extends A { ... };
|
ACTION_GOTO_FRAME |
Change the frame number of the playback.
The ACTION_GOTO_FRAME action changes the frame number of the playback. This means the playback of the movie continues at the frame specified by the ACTION_GOTO_FRAME. The frame is hard coded in the action so this action is not usually very useful unless your frame number is a constant number. Use the sswf::Action::ACTION_GOTO_EXPRESSION instead to be able to use a variable frame number.
|
ACTION_URL |
Load the specified URL.
The ACTION_URL action loads the specified URL. The target specifies how the new URL should be loaded. "_level1" means that the SWF movie is replaced. "_top" replaces the entire window. "_blank" opens a new window. A frame name will reload that frame. It is also possible to execute some Javascript code using the javascript: protocol instead of http or https.
|
ACTION_STORE_REGISTER |
Store the value currently at the top of the stack in a register.
The ACTION_STORE_REGISTER action saves the value currently at the top of the stack in the specified register. The value on the stack is not popped. The maximum register number varies depending on the version of the player and whether you are in a function or the global space. A register can later be read with an sswf::Action::ACTION_PUSH_DATA.
|
ACTION_DECLARE_DICTIONARY |
Declare a special array of strings which can later be pushed on the stack.
The ACTION_DECLARE_DICTIONARY action is a list of null terminated strings. These strings are numbered from 0 to 65534 and can later be pushed on the stack with an sswf::Action::ACTIO_PUSH_DATA. This is used to compress your movies. If the same rather long string needs to be pushed onto the stack many times, repeating it in each Push Data would generate a larger action script than putting it once in a dictionary and pushing it using the special "push a dictionary entry" feature. The gain can be very small. You need to measure the length of the string, the overhead of declaring a dictionary and the number of times a string is used. If used once, no dictionary is necessary. If the string is one character, using the dictionary will actually make you lose 1 byte per Push Data...
|
ACTION_STRICT_MODE |
Whether the ActionScript engine is strict or not.
The ACTION_STRICT_MODE action sets the strict mode flag to true or false. When the strict mode is true, more checks are done to ensure that the ActionScript running is more compliant to the ECMA specification.
|
ACTION_WAIT_FOR_FRAME |
Wait for the specified frame.
The ACTION_WAIT_FOR_FRAME action is an old action used to wait for a frame while loading on a slow modem and such. Thus you could know what was loaded to know whether you could display such and such sprite. Often, the actions to execute when the frame was finaly loaded is an sswf::Action::ACTION_BRANCH_ALWAYS which skips the actions to be executed when the frame was not yet loaded. There is now ways to check for the frame number and use a regular sswf::Action::ACTION_BRANCH_IF_TRUE action instead.
|
ACTION_SET_TARGET |
Apply actions to the specified sprite (or movie).
The ACTION_SET_TARGET action is used to optimize the code or call a sub-function which apply functions on what is considered the current movie. This current movie is defined by name with this action. An empty name refer to the main movie (the root). When the name of a specific sprite is used, then that specific sprite functions are called.
|
ACTION_GOTO_LABEL |
Change the current frame in the playback system.
The ACTION_GOTO_LABEL action requests the current sprite to now play starting at the named frame. A frame is named using the FrameLabel tag.
|
ACTION_WAIT_FOR_FRAME2 |
Wait for the specified frame.
The ACTION_WAIT_FOR_FRAME2 action pops one value from the stack. This value represents the frame it has to wait for. The action otherwise has a new of action it has to skip in case the frame was not reached yet.
|
ACTION_DECLARE_FUNCTION2 |
Declare a function.
The ACTION_DECLARE_FUNCTION2 action creates a user function with capabilities as defined in SWF version 7 (i.e. up to 255 registers to use instead of local variables and for temporary computations.) These functions can also pre-define a set of registers to the internal variables such as _root, _global and this. A function declared as void is not expected to return anything on the stack. Yet the caller will get an undefined value. A function not declared as void is expected to return a valid value with the use of the sswf::Action::ACTION_RETURN action.
|
ACTION_TRY |
Create a try/catch/finaly block.
The ACTION_TRY action is used to create a block of actions to execute safely. This means, if an exception occurs, it is possible to catch it. The entire block is composed of one try block, zero or more catch blocks and zero or one finaly block. There must be one catch or one finaly block. The finaly block is always executed. A catch block is executed only if the corresponding exception is caught. Note that internally, there is only one catch. Your compiler may decided to offer you a way to catch a specific type of exception by checking the type of the exception (see sswf::Action::ACTION_INSTANCE_OF).
|
ACTION_WITH |
Create a With block.
The ACTION_WITH action is a block of actions which react to object names by first searching the name specified by the With block. For instance, if you have an object named MyObject and you want to access the field NiceField in that object, you need to use the name:
v = MyObject.NiceField In general this is not a problem, but when many fields need to be accessed, it is possible to optimize using a With block:
With MyObject v = NiceField In this last case, the variable NiceField is first searched as a variable member in the MyObject object. Note that this technic works to read variable members and modify existing variable members. If you need to create a new member, you will need to specify the object name.
|
ACTION_PUSH_DATA |
Push constants and register data on the stack.
The ACTION_PUSH_DATA action defines a block of data to push on the stack. It is possible to push a constant string, boolean, integer, floating point, null and the undefined value. Also, it is possible to specify a register number to load. This is the only way you can load a register set with sswf::Action::ACTION_STORE_REGISTER. To read a variable, you first push its name on the stack using this action, then you use the sswf::Action::ACTION_GET_VARIABLE.
|
ACTION_BRANCH_ALWAYS |
Change the current execution pointer.
The ACTION_BRANCH_ALWAYS action changes the execution pointer by the specified number of bytes. The offset is a signed 16 bits value. This means the jump is limited to a 64Kb span. Note that most ActionScripts should anyway be limited to about 32Kb.
|
ACTION_URL2 |
Load the specified URL.
The ACTION_URL2 action loads the specified URL. This is similar to ACTION_URL except that the URL itself is taken from the stack and thus can dynamically be defined (i.e. read from a variable, created using an expression, etc.)
|
ACTION_DECLARE_FUNCTION |
Declare a function.
The ACTION_DECLARE_FUNCTION action creates a user function with capabilities as defined in SWF version 5. These functions do not support pre-set registers or more than 4 registers. A function declared as void is not expected to return anything on the stack. Yet the caller will get an undefined value. A function not declared as void is expected to return a valid value with the use of the sswf::Action::ACTION_RETURN action.
|
ACTION_BRANCH_IF_TRUE |
Change the current execution pointer if true.
The ACTION_BRANCH_IF_TRUE action branches if the value it pops from the stack represents true. A true number is a non-zero number. A true string is a non-empty string. Other objects may have a toBoolean() function which returns true or false according to their type. The same limitations apply to this branch as for the sswf::Action::ACTION_BRANCH_ALWAYS action. To branch when false, use the sswf::Action::ACTION_LOGICAL_NOT right before this branch.
|
ACTION_CALL_FRAME |
Call the actions defined in a frame.
The ACTION_CALL_FRAME action is an early bird function definition. You should use the sswf::Action::ACTION_DECLARE_FUNCTION and then an sswf::Action::ACTION_CALL_FUNCTION instead. This frame calling is nothing more than a function call, really. The name or number if the frame to call is popped from the stack.
|
ACTION_GOTO_EXPRESSION |
Move the display pointer to the specified frame.
The ACTION_GOTO_EXPRESSION action pops a string or integer from the stack and go to the frame. The action also specifies whether the movie should stop or play.
|
ACTION_max |
The very last valid action.
The ACTION_max definition is used to clamp action numbers valid in an SWF movie. Note that this is not the largest action number but instead the maximum action number which can possibly be accepted at all time (until the action scheme changes!) At this time this value is 255 which is inclusive.
|
The Action constructor is used to initialize an action object.
Once an action was created, you cannot change its type. You cannot copy an action with the copy constructor or the assignment operator. You can however sswf::Action::Duplicate() an action.
The constructor will determine the version of the action. This is important to determine the minimum version necessary for that action to function in the output SWF animation.
At this time, you can add actions to any tags (but this may change!) However, only a few set of tags really support actions:
References ACTION_LABEL, ACTION_max, ACTION_min, sswf::assert(), f_min_version, and f_tag.
Referenced by Duplicate(), and Parse().
sswf::Action::~Action | ( | void | ) | [inline, virtual] |
This function exists because the Action class defines virtual function. It has otherwise nothing to do here.
Action * Action::Duplicate | ( | void | ) | const [virtual] |
This function creates a clone of 'this' Action.
The function knows how to create a new Action which is a clone of this Action.
Actions with extraneous data will overwrite this function and duplicate their extraneous data as required.
Reimplemented in sswf::ActionBranch, sswf::ActionDictionary, sswf::ActionFunction, sswf::ActionGoto, sswf::ActionLabel, sswf::ActionPushData, sswf::ActionSetTarget, sswf::ActionStoreRegister, sswf::ActionStrictMode, sswf::ActionTry, sswf::ActionURL, sswf::ActionWaitForFrame, and sswf::ActionWith.
References Action(), f_action, and f_tag.
Referenced by sswf::ActionWith::Duplicate(), sswf::ActionWaitForFrame::Duplicate(), sswf::ActionTry::Duplicate(), sswf::ActionFunction::Duplicate(), sswf::TagDoAction::SetAction(), and sswf::TagButton::SetAction().
ActionLabel * Action::FindLabel | ( | const Vectors & | list, | |
const char * | label | |||
) | [static] |
A special SSWF Action is the Label Action. The label action is NOT saved in the output SWF animation files. However, it is required to allow branches to jump from one place to another without the burden of using just offsets to know where the label would otherwise be.
The ActionBranch will search for labels.
[in] | list | The list of actions to be searched |
[in] | label | The label to be searched |
References ACTION_LABEL, sswf::Vectors::Count(), f_action, sswf::Vectors::Get(), and sswf::ActionLabel::GetLabel().
Referenced by sswf::ActionBranch::Save2ndPass().
ActionLabel * Action::FindLabelAtOffset | ( | Vectors & | list, | |
unsigned long | offset | |||
) | [static] |
Actions that branch from their current location to another location in the code use a signed offset.
Here we expect the offset to represent the exact destination (since we do not know the source action asking for the offset and depending on the action, the math varies.)
Since the point in the end is to have a label, this function creates the label and returns it.
[in] | list | The list of actions to be searched. |
[in] | offset | The offset to be searched. |
References sswf::Vectors::Count(), f_offset, f_tag, sswf::Vectors::Get(), sswf::Vectors::Insert(), sswf::MemoryManager::MemAttach(), and sswf::ActionLabel::SetLabel().
Referenced by sswf::ActionBranch::Parse2ndPass().
int Action::GetMaximumRegister | ( | const Vectors & | list | ) | [static] |
This function goes through the list of actions defined in the Vectors array and determines what the largest register used by any of the instructions is in that array.
This is necessary to determine the largest used register in a version 7 function (See Declare Function (V7).) Before version 7, there could only be 4 registers and you never had to determine which ones were used.
[in] | list | A Vectors of actions |
References sswf::Vectors::Count(), f_action, sswf::Vectors::Get(), GetMaxRegister(), and SubList().
Referenced by sswf::ActionTry::GetMaxRegister().
int sswf::Action::GetMaxRegister | ( | void | ) | const [inline, protected, virtual] |
This function goes through all the list and sub-lists of actions and retrieve the largest register currently in use.
Reimplemented in sswf::ActionPushData, sswf::ActionStoreRegister, and sswf::ActionTry.
Referenced by GetMaximumRegister(), and sswf::ActionFunction::SaveData().
int Action::MinimumListVersion | ( | const Vectors & | list | ) | [static] |
This function sweeps through all the actions found in an array and determines the minimum SWF version required for the script to run.
For instance, the 'New Method' action requires at least a version 5 Flash Player to work.
References sswf::Vectors::Count(), f_action, sswf::Vectors::Get(), SubList(), and Version().
Referenced by sswf::TagPlace::PreSave(), sswf::TagDoAction::PreSave(), sswf::TagButton::PreSave(), and sswf::ActionTry::Version().
unsigned long sswf::Action::Offset | ( | void | ) | const [inline] |
The position of an action can be used to compute different offsets such as the ActionBranch offset to get the current ActionScript pointer to a specific position in the script.
References f_offset.
Referenced by sswf::ActionBranch::Save2ndPass().
ErrorManager::error_code_t Action::OnError | ( | ErrorManager::error_code_t | errcode, | |
const char * | message, | |||
... | ||||
) | const |
This function calls the sswf::ErrorManager::OnError(error_code_t errcode, const char *message, va_list ap) function whenever possible.
The function will not be called if the action was not given a valid tag object pointer on creation.
[in] | errcode | The error code that this call represents |
[in] | message | The message of this error |
[in] | ... | The parameters to the message |
References f_tag, and sswf::TagBase::OnError().
Referenced by sswf::ActionPushData::ParseData(), sswf::ActionGoto::ParseData(), ParseData(), Save(), sswf::ActionBranch::Save2ndPass(), sswf::ActionWaitForFrame::SaveData(), sswf::ActionTry::SaveData(), sswf::ActionPushData::SaveData(), sswf::ActionGoto::SaveData(), sswf::ActionFunction::SaveData(), SaveData(), and SaveList().
ErrorManager::error_code_t Action::Parse | ( | TagBase * | tag, | |
const Data & | data, | |||
Vectors & | actions | |||
) | [static] |
This function parses the data buffer for one action.
It is expected that the end of the buffer was not reached yet.
In general, you will call the ParseList() function to parse all the actions found in a Data buffer.
[in] | tag | The action are being read for this tag |
[in] | data | The Data buffer being parsed |
[in] | actions | The resulting vector of actions |
References Action(), ACTION_BRANCH_ALWAYS, ACTION_BRANCH_IF_TRUE, ACTION_CALL_FRAME, ACTION_DECLARE_DICTIONARY, ACTION_DECLARE_FUNCTION, ACTION_DECLARE_FUNCTION2, ACTION_GOTO_EXPRESSION, ACTION_GOTO_FRAME, ACTION_GOTO_LABEL, ACTION_PUSH_DATA, ACTION_SET_TARGET, ACTION_STORE_REGISTER, ACTION_STRICT_MODE, ACTION_TRY, ACTION_URL, ACTION_URL2, ACTION_WAIT_FOR_FRAME, ACTION_WAIT_FOR_FRAME2, ACTION_WITH, sswf::ErrorManager::ERROR_CODE_NONE, sswf::ErrorManager::ERROR_CODE_UNKNOWN_ACTION, f_offset, sswf::Data::GetByte(), sswf::Data::GetReadPosition(), sswf::Data::GetShort(), ParseData(), and sswf::Vectors::Set().
Referenced by sswf::ActionWaitForFrame::ParseData(), and ParseList().
ErrorManager::error_code_t Action::Parse2ndPass | ( | Vectors & | list | ) | [protected, virtual] |
This function is used to fix the different branches after a load.
[in] | list | The vector of actions to tweak as required. |
Reimplemented in sswf::ActionBranch.
References sswf::ErrorManager::ERROR_CODE_NONE.
ErrorManager::error_code_t Action::ParseData | ( | const Data & | data | ) | [protected, virtual] |
All the actions having a byte code larger than 127 include extra-data.
These actions need to overload this function and load that extraneous data when requested to do so.
The default function asserts.
[in] | data | The Data buffer where the extraneous information is to be loaded from. |
Reimplemented in sswf::ActionBranch, sswf::ActionCallFrame, sswf::ActionDictionary, sswf::ActionFunction, sswf::ActionGoto, sswf::ActionPushData, sswf::ActionSetTarget, sswf::ActionStoreRegister, sswf::ActionStrictMode, sswf::ActionTry, sswf::ActionURL, sswf::ActionWaitForFrame, and sswf::ActionWith.
References sswf::assert(), sswf::ErrorManager::ERROR_CODE_INTERNAL_ERROR, f_action, and OnError().
Referenced by Parse().
ErrorManager::error_code_t Action::ParseList | ( | TagBase * | tag, | |
const Data & | data, | |||
Vectors & | actions | |||
) | [static] |
This function reads actions from the specified Data buffer until the end of the buffer is reached.
When reading data in a nested list, the data buffer will be constrained to the size of the nested list using the limit function.
The only exceptions are the ACTION_WAIT_FOR_FRAME and ACTION_WAIT_FOR_FRAME2 that uses a count instead of a size. For these special cases, the ParseData() function handles it by directly calling Parse() 'count' times.
[in] | tag | The action are being read for this tag |
[in] | data | The Data buffer being parsed |
[in] | actions | The resulting vector of actions |
References sswf::ErrorManager::ERROR_CODE_NONE, sswf::Data::IsEndOfData(), and Parse().
Referenced by sswf::ActionWith::ParseData(), sswf::ActionTry::ParseData(), sswf::ActionFunction::ParseData(), sswf::TagDoAction::ParseTag(), and sswf::TagButton::ParseTag().
ErrorManager::error_code_t Action::Save | ( | Data & | data | ) |
This function saves 'this' Action in the specified Data buffer.
Simple actions have their byte code saved and the function returns.
Composed actions have their SaveData() virtual function called.
Also, actions which can include sub-ations (such as a Function or a With action) get their SubList() saved as well.
The result in an SWF animation just looks like a long list of byte codes. The reality is that this technique generates blocks of actions.
[in] | data | The data buffer where the actions need to be saved |
References sswf::Data::Append(), sswf::Data::ByteSize(), sswf::ErrorManager::ERROR_CODE_ACTION_OVERFLOW, sswf::ErrorManager::ERROR_CODE_NONE, f_action, sswf::Data::GetSize(), sswf::ErrorManager::KeepFirst(), OnError(), sswf::Data::PutByte(), sswf::Data::PutShort(), SaveData(), SaveList(), sswf::Data::SetSize(), and SubList().
Referenced by SaveList().
ErrorManager::error_code_t Action::Save2ndPass | ( | const Vectors & | list, | |
Data & | data | |||
) | [protected, virtual] |
This function is called after all the actions have been saved in a list of actions (i.e. sswf::Action::SaveList() calls sswf::Action::Save() on all the actions of a list and then sswf::Action::Save2ndPass().)
At this time, the only action which requires this second pass is the sswf::ActionBranch. It will search for a label and save the proper offset from itself to the label.
[in] | list | The list of all the actions being saved |
[in] | data | The Data buffer where the actions were saved |
Reimplemented in sswf::ActionBranch.
References sswf::ErrorManager::ERROR_CODE_NONE.
Referenced by SaveList().
ErrorManager::error_code_t Action::SaveData | ( | Data & | data, | |
Data & | nested_data | |||
) | [protected, virtual] |
All the actions having a byte code larger than 127 include extra-data.
These actions need to overload this function and save that extraneous data when requested to do so.
The default function asserts.
[in] | data | The Data buffer where the extraneous information is to be saved. |
[in] | nested_data | When the action supports sub-actions, the Data buffer where these sub-actions have been saved. |
Reimplemented in sswf::ActionBranch, sswf::ActionCallFrame, sswf::ActionDictionary, sswf::ActionFunction, sswf::ActionGoto, sswf::ActionPushData, sswf::ActionSetTarget, sswf::ActionStoreRegister, sswf::ActionStrictMode, sswf::ActionTry, sswf::ActionURL, sswf::ActionWaitForFrame, and sswf::ActionWith.
References sswf::assert(), sswf::ErrorManager::ERROR_CODE_INTERNAL_ERROR, f_action, and OnError().
Referenced by Save().
ErrorManager::error_code_t Action::SaveList | ( | const Vectors * | list, | |
Data & | data, | |||
const Vectors * | extra = 0 | |||
) |
This function is used to save a list of actions in a Data buffer for output in a Flash animation.
[in] | list | The list of actions to be saved, it can be NULL |
[in] | data | The Data buffer where the result is saved |
[in] | extra | Another list of actions saved after the 'list' of actions, usually is NULL |
References ACTION_END, ACTION_LABEL, sswf::Data::ByteSize(), sswf::Vectors::Count(), sswf::ErrorManager::ERROR_CODE_ENDED_ACTION_SCRIPT, sswf::ErrorManager::ERROR_CODE_NONE, f_action, f_offset, sswf::Vectors::Get(), sswf::ErrorManager::KeepFirst(), OnError(), sswf::Data::PutByte(), Save(), and Save2ndPass().
Referenced by sswf::TagPlace::Save(), sswf::TagDoAction::Save(), sswf::TagButton::Save(), Save(), and sswf::ActionTry::SaveData().
ErrorManager::error_code_t Action::SaveString | ( | Data & | data, | |
const char * | string | |||
) | [protected] |
This functions saves a string in the Data buffer in a way that the SWF actions can read it.
The function simply calls the SaveString() of the corresponding tag thus converting the string as required for a version 5 or earlier movie. Strings are otherwise expected to be in UTF-8.
[in] | data | The Data buffer where the string is to be saved |
[in] | string | The string to save in the Data buffer |
References f_tag, and sswf::TagBase::SaveString().
Referenced by sswf::ActionURL::SaveData(), sswf::ActionTry::SaveData(), sswf::ActionSetTarget::SaveData(), sswf::ActionPushData::SaveData(), sswf::ActionGoto::SaveData(), sswf::ActionFunction::SaveData(), and sswf::ActionDictionary::SaveData().
Vectors * Action::SubList | ( | void | ) | [virtual] |
By default, this function returns a NULL pointer. Actions which support sub-actions (such as a ActionFunction or ActionWith) will return their array of sub-actions.
Reimplemented in sswf::ActionFunction, sswf::ActionWaitForFrame, and sswf::ActionWith.
Referenced by GetMaximumRegister(), MinimumListVersion(), and Save().
TagBase * sswf::Action::Tag | ( | void | ) | const [inline, protected] |
This function returns the pointer to the tag this action was created in (see the constructor!).
References f_tag.
Referenced by sswf::ActionWith::Duplicate(), sswf::ActionWaitForFrame::Duplicate(), sswf::ActionURL::Duplicate(), sswf::ActionTry::Duplicate(), sswf::ActionStrictMode::Duplicate(), sswf::ActionStoreRegister::Duplicate(), sswf::ActionSetTarget::Duplicate(), sswf::ActionPushData::Duplicate(), sswf::ActionLabel::Duplicate(), sswf::ActionGoto::Duplicate(), sswf::ActionFunction::Duplicate(), sswf::ActionDictionary::Duplicate(), sswf::ActionBranch::Duplicate(), sswf::ActionWith::ParseData(), sswf::ActionWaitForFrame::ParseData(), sswf::ActionTry::ParseData(), sswf::ActionFunction::ParseData(), sswf::ActionWaitForFrame::SaveData(), and sswf::ActionGoto::SaveData().
unsigned char sswf::Action::Version | ( | void | ) | const [inline, virtual] |
The minimum version required for any action is defined on creation of the action. The sswf::Action::Action(TagBase *tag, action_t action) function has a table which tells it the minimum SWF version required for such and such action to work thus you can query this value at any time.
Reimplemented in sswf::ActionTry.
References f_min_version.
Referenced by MinimumListVersion().
const action_t sswf::Action::f_action [protected] |
This variable member holds the action code of this action. It is currently read-only since changing it would require changes to the minimum version and size information.
Referenced by sswf::ActionFunction::AddParameter(), sswf::ActionWaitForFrame::Duplicate(), sswf::ActionURL::Duplicate(), sswf::ActionGoto::Duplicate(), sswf::ActionFunction::Duplicate(), sswf::ActionBranch::Duplicate(), Duplicate(), FindLabel(), GetMaximumRegister(), MinimumListVersion(), sswf::ActionWaitForFrame::ParseData(), sswf::ActionURL::ParseData(), sswf::ActionGoto::ParseData(), sswf::ActionFunction::ParseData(), ParseData(), Save(), sswf::ActionWaitForFrame::SaveData(), sswf::ActionURL::SaveData(), sswf::ActionGoto::SaveData(), sswf::ActionFunction::SaveData(), SaveData(), and SaveList().
unsigned char sswf::Action::f_min_version [private] |
unsigned long sswf::Action::f_offset [protected] |
This offset defines the position at which the action was inserted in the Data buffer while in the sswf::Action::Save() function.
Referenced by FindLabelAtOffset(), Offset(), Parse(), sswf::ActionBranch::ParseData(), sswf::ActionBranch::Save2ndPass(), and SaveList().
TagBase* sswf::Action::f_tag [private] |
Referenced by Action(), Duplicate(), FindLabelAtOffset(), GetTag(), OnError(), SaveString(), and Tag().