Using Objects in ActionScript > Controlling ActionScript order of execution for class assignments |  |

Controlling ActionScript order of execution for class assignments

You place actions to assign a class on the first frame of a movie clip symbol. In the normal order of execution in ActionScript, the actions assigning the class would be executed at the end of the frame. However, in most circumstances you will want the class assignment to be executed in front of the frame, before the movie clip is instantiated, so that any properties of the class are enabled as soon as the movie clip appears. In order to execute the class assignment actions in front of the frame, you must add the tags `#initclip` and `#endinitclip` at the beginning and end of the actions.

To execute a class assignment in front of the frame in which the code is placed:

Use the following syntax:

    #initclip
    function Constructor(value1, value2, value3){

    this.property1 = value1;
    this.property2 = value2;
    this.property3 = value3;

    }
    #endinitclip