Skip to main content
Inspiring
February 14, 2017
Answered

Get Current frame

  • February 14, 2017
  • 2 replies
  • 17846 views

Hello, I have searched the forums and can't seem to get an answer on how to get the current frame using createJS. Any help would be much appreciated. This has always been an easy thing to do in past version.. Thanks

    This topic has been closed for replies.
    Correct answer Colin Holgate

    This is another example of something that was added with v0.7.1. If you were looking in 0.7.0 docs you wouldn't have found currentFrame.

    2 replies

    Legend
    February 14, 2017

    Incidentally, if you type "createjs current frame" into Google, literally the first search result answers this question.

    aewuAuthor
    Inspiring
    February 15, 2017

    Yes, I used Google first, thank you. Apologies for not mentioning that I already tried this.currentFrame. However, the output I am getting no matter where I am in the timeline is 0.

    What I ended up doing is adding a ticker and manually incrementing it:

    function handleTick(event) {

         theCurrentFrame = theCurrentFrame+1;

         console.log(theCurrentFrame);

    }

    Legend
    February 15, 2017

    http://www.createjs.com/docs/easeljs/classes/MovieClip.html#property_currentFrame

    Or if you don't feel like using that, this.timeline.position provides raw access to the current frame.

    If this.currentFrame is returning 0 when you think it shouldn't, then your this is wrong. Are you perchance accessing it in an event handler? If you create a new blank canvas document and stick an alert(this.currentFrame); in the tenth or whatever frame of the root timeline, does it not report the current frame?

    Colin Holgate
    Inspiring
    February 14, 2017

    this.currentFrame