Made to Order Software Corporation Logo

SWF Internal Functions

Since Flash version 5, you can use internal functions (really member functions or methods of internal objects.) These functions are always available. These methods are called using the Call Function action with the name of the object and function separated by a period. A few of these internal functions are duplicates of some direct action script instructions. In general, it is preferred to use these internal functions rather than the direct action. However, direct actions are a good way to optimize your ActionScript code.

Similarly, you can access internal constants (really variable members of internal objects such as the number π.) These constants are always available. These variable members are read using the Get Variable action with the name of the object and variable separated by a period. This can increase the precision of some values such a π and e and give you information about the system on which the plug-in is currently running. These variable members are usually read-only.

The name of the objects and their functions are case insensitive. Thus "Math.SIN"is equivalent to "math.sin".

Sample to compute the sine of an angle given in degree:

	// expect the angle on the top of the stack here
	Push Data (string) "math.pi"
	Get Variable
	Multiply
	Push Data (float) 180.0
	Swap
	Divide
	Push Data (integer) 1
		  (string) "math.sin"
	Call Function
	// the result is on the top of the stack
	// i.e.:  math.sin(<input> * math.pi / 180.0);

Since Version 8, Macromedia created a new website called livedocs that includes a complete and up to date documentation of the scripting language (ActionScript) and the default objects coming with Flash players. To some extend, it is otherwise possible to enumerate most of the objects available with the Enumerate Object action.