Undocumented Actionscript 3

A little undocumented feature for you that might come in useful, mainly for people who use the Flash 9 Authoring Tool to create their Flash Movies.

It allows you to specify a function that is called when the playhead of the Movieclip timeline enters the specified frame number.

Their are four parameters to the method, i only completley understand the purpose of the first two, the other two are worth investigating more.

MovieClip.addFrameScript(frame:uint,notify:Function)

Example:

function output()

{

    trace('Timeline is on the 10th frame')

}//frame numbers are zero based

addFrameScript(9,output)

Ensure the timeline you add this code to, has atleast 10 frames.

Removing frame scripts

Ive worked out that passing false as the third parameter and anything as the fourth parameter, clears the function, so that it is no longer called when the playhead enters a previously defined frame number/function combo.

//stop calling the output function

addFrameScript(9,output,false,false);

Tags: , ,

3 Responses to “Undocumented Actionscript 3”

  1. furious says:

    Hmm.. its very useful.

  2. Keith H says:

    Do you think “addFrameScript” will be official?
    I noticed the keyword show up in Flex Builder’s auto-completion list, but did not see the keyword in the Help docs.

  3. Han Sanghun says:

    Thanks for the post. This is very handy.