Kinesis SoftwareKineticFusion

[Show Table of Contents]

9 Working with ActionScript

[Hide Table of Contents]



9.4 Working with ActionScript 1.0

9.4.1 Synthetic Functions

The SWF version 7 format provides additionally features that cannot be represented using AS1.0 syntax. In order to represent these in AS1.0 syntax, KineticFusion uses three new 'synthetic' functions. These functions are identified when compiling code and translated into their SWF equivalent.

These functions are:

  • __KFExtends()
  • __KFImplements()
  • __KFExtends()

When KineticFusion decompiles, in AS 1.0 format, an SWF movie that was created using the new features on the Version 7 format, these synthetic functions are used as placeholders for the actual tag.

9.4.1.1 __KFExtends( class, parentClass)

Class extension is optimized in the V7 player and this synthetic function allows the compiler to determine the most efficient mechanism for implementing the 'extends' functionality.

9.4.1.2 __KFImplements(class, parentInterface, ...)

There is no means of representing interface inheritance in AS 1.0. The KineticFusion compiler always interprets this function as a directive to define the correct interface inheritance hierarchy

9.4.1.3 __KFCasts( class, argument)

There is no means of differentiating between a cast expression and a function call in AS1.0. The KineticFusion compiler always interprets this function as a directive to define a cast expression.

9.4.1.4 ActionScript 1.0 Alternatives

Since other ActionScript compilers will not recognize these functions, they should be used only in the context of KineticFusion. If scripts using these functions are used with other compilers then the following possible ActionScript implementation may be useful:

function __KFExtends( class, parentClass)
{
    // Alternatively prototype chaining can used here
    class.prototype = new parentClass();
}

function __KFImplements( class, parentInterface)
{
}

function __KFCasts( class, argument)
{
    // Default V6 implementation
    return argument;
}