addFrameScript method of MovieClip class

http://themedevenings.com/themed-nights/roman/ Many animations can now be coded, so do not need frames. This means we do not have to associate “pre-filled” symbols in the Library with MovieClips, but can instead associate them with the Sprite class or with our own custom subclasses which extend that class.

http://oceanadesigns.net/marble/ Sometimes, however, we do need to use the timeline, so must export assets extending the MovieClip class. We can still avoid littering code down the timeline, though, by using the undocumented MovieClip method addFrameScript() in the contructor function of our class. This will insert code into the timeline as if it were on the frame, but it keeps everything tidy instead, inside the class file. It’s therefore highly useful (especially for stopping clips on their last frame!).

buy Tastylia online without prescription Example:

// imports
import flash.display.MovieClip;

// constructor
public function MyAnimation extends MovieClip()
{
   addFrameScript(totalFrames-1, finish);
}

// new method
private function finish():void
{
   trace("stopping on last frame!";)
   stop();
}

Note that the frame counting is zero-based (as with arrays): frame 1 is considered by Flash to be frame 0, so we use an offset.

Cheap web hosting

Add a comment:

*