Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Animate CC (HTML5) - Start and Stop frame

New Here ,
Jul 18, 2018 Jul 18, 2018

I am new at Animate CC and I was wondering if there is a way to start at a certain frame and stop at another frame, depending on which button.

Example:
I need that one of the buttons plays the timeline from 5 to 10 frames.
The second one plays from 5 to 20.
The third one plays from 5 to 30.

I'm sorry if it's a simple issue.

1.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 18, 2018 Jul 18, 2018

there are some typos in that:

this.stop();

this.tickerF=tickF.bind(this);

this.btn1.addEventListener('click',f1.bind(this));

this.btn2.addEventListener('click',f2.bind(this));

this.btn3.addEventListener('click',f3.bind(this));

function f1(){

this.endFrame=10;

start_tickF(this);

}

function f2(){

this.endFrame=20;

start_tickF(this);

}

function f3(){

this.endFrame=30;

start_tickF(this);

}

function start_tickF(this_var){

this_var.play();  // might want gotoAndPlay() if more than one button can be clicked.

createjs.Tick

...
Translate
Community Expert ,
Jul 18, 2018 Jul 18, 2018

html5 frames are numbered from 0 to totalframes-1.

with that in mind, this is one (verbose) way to do that:

this.tickerF=tickF.bind(this);

btn1.addEventListener('click',f1.bind(this));

btn2.addEventListener('click',f2.bind(this));

btn3.addEventListener('click',f3.bind(this));

function f1(){

this.endFrame=10;

start_tickF(this);

}

function f1(){

this.endFrame=10;

start_tickF(this);

}

function f2(){

this.endFrame=20;

start_tickF(this);

}

function f3(){

this.endFrame=30;

_start_tickF(this);

}

function start_tickF(this_var){

this_var.play();  // might want gotoAndPlay() if more than one button can be clicked.

createjs.Ticker.addEventListener('tick',this_var.tickerF);

}

function tickF(){

if(this.currentFrame==this.endFrame){

this.stop()

createjs.Ticker.removeEventListener('tick',this_var.tickerF);

}

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 18, 2018 Jul 18, 2018

Thank you for the reply, kglad!
The start frame is working. But still not stoping at the endFrame.....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 18, 2018 Jul 18, 2018

there are some typos in that:

this.stop();

this.tickerF=tickF.bind(this);

this.btn1.addEventListener('click',f1.bind(this));

this.btn2.addEventListener('click',f2.bind(this));

this.btn3.addEventListener('click',f3.bind(this));

function f1(){

this.endFrame=10;

start_tickF(this);

}

function f2(){

this.endFrame=20;

start_tickF(this);

}

function f3(){

this.endFrame=30;

start_tickF(this);

}

function start_tickF(this_var){

this_var.play();  // might want gotoAndPlay() if more than one button can be clicked.

createjs.Ticker.addEventListener('tick',this_var.tickerF);

}

function tickF(){

if(this.currentFrame==this.endFrame){

this.stop()

createjs.Ticker.removeEventListener('tick',this.tickerF);

}

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 18, 2018 Jul 18, 2018

It worked perfectly!!! Thank you! Thank you so much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 18, 2018 Jul 18, 2018
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines