How do I get the current position (frame) of a movie clip in EaselJS?

I have a MovieClip that fades in and then fades out. I’d like to find the half way mark in this movie clip and pause it. However in EaselJS I cannot find any way to get the movie clip’s current frame position. Is this possible?

I’d like to do something like the following:

  • Strange Font Behaviour On HTML Canvas
  • Duplicating a canvas many times: clone the canvas or copy the image data?
  • Load image from url and draw to HTML5 Canvas
  • Image not drawn on canvas until user clicks?
  • Detect “image corrupt or truncated” in Firefox
  • Using drawImage() to output fixed size images on a canvas?
  •  canvas = document.getElementById("introCanvas");
            exportRoot = new lib.MyMovieClip();
            exportRoot.onTick = function () {
                //get the mc's length in frames
                //get the current frame position
                //if current frame postion == mc's lenght / 2
                       //then pause movie clip

    Can anyone provide me with some suggestions or ideas for how I might accomplish the above?


  • ChartJS Doughnut Charts Gradient Fill
  • How to increase DPI when saving a canvas to the server as a jpg file?
  • Drawing a rectangle using click, mouse move, and click
  • Make a hole in canvas background or in a rect
  • Argument 1 of CanvasRenderingContext2D.drawImage could not be converted ( attempting draw image on canvas object )
  • How to Draw an image on canvas from a byte array in jpeg or png format
  • 2 Solutions collect form web for “How do I get the current position (frame) of a movie clip in EaselJS?”

    After reading through the documentation, it seems that a TweenJS Timeline is automatically allocated to manage the change in the animation, it doesn’t look like there are any actual frames like we see in flash.

    If you look at the docs for TweenJS Timeline its possible you could use the duration property, as the docs state:

    Read-only property specifying the total duration of this timeline in milliseconds (or ticks if useTicks is true). This value is usually automatically updated as you modify the timeline. See updateDuration for more information.

    So if you get the duration and divide by 2, or multiply by 0.5 😉 then you could find out the middle point of your animation. Try using this in your onTick method to see if it works.

    I always do this…


    Or another way…

    var tl = movieclip.timeline;
    var d = timeline.duration;

    You have to get the movieclip’s timeline’s position & duration, and add a %. This will get the current frame of the movieclip.