How can I get the current position (image) of a movie clip in EaselJS?

advertisements

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:

 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?

Thanks!


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.