gotoAndPlay method

void gotoAndPlay(
  1. int frame, {
  2. int lastFrame = -1,
})

Advances the movie clip to the specified frame and begins playing.

frame is the index of the frame to advance to.

lastFrame is the index of the frame at which to stop playback. If not specified, the movie clip will play until the last frame.

Implementation

void gotoAndPlay(int frame, {int lastFrame = -1}) {
  gotoFrame(frame);
  if (lastFrame > frameCount) {
    lastFrame %= frameCount;
  } else if (lastFrame > -1 && lastFrame < frame) {
    /// TODO: add repeatable logic?
  }
  targetFrame = lastFrame;
  play();
}