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

how to access timeline when html5 video is played in adobe animate cc

New Here ,
Apr 22, 2017 Apr 22, 2017

Copy link to clipboard

Copied

hi every body..

I've searched long time...

I 'm working on html 5 canvas project using adobe animate cc. I 've mp4 video on the timeline and I have some content on the timeline.

The question is How can I make the timeline start playing when I click  on the play button of the video ??

I've used the following, but it did not work...

var pos = 0;

// Assign an ontimeupdate event to the video element, and execute a function if the current playback position has changed

vid.ontimeupdate = function() {myFunction()};

function myFunction() {

  pos = Math.round(vid.currentTime*24);

  // where 24 is the current frame rate

  inputTxt.value = pos;

  this.stop(pos+1);

}

Views

1.0K

Translate

Translate

Report

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

LEGEND , Apr 24, 2017 Apr 24, 2017

Event handlers default to executing in the global window context. Yes, this was a very poorly thought out design decision, but now we're stuck with it.

To force a function to execute in a specific context, you have to use .bind() on it.

Function.prototype.bind() - JavaScript | MDN

Votes

Translate

Translate
LEGEND ,
Apr 22, 2017 Apr 22, 2017

Copy link to clipboard

Copied

Sticking an alert(this); in your event handler would be enlightening.

Votes

Translate

Translate

Report

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 ,
Apr 22, 2017 Apr 22, 2017

Copy link to clipboard

Copied

A little correctness:

this.play(pos+1); instead of  this.stop(pos+1);

Votes

Translate

Translate

Report

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
LEGEND ,
Apr 23, 2017 Apr 23, 2017

Copy link to clipboard

Copied

Neither are correct. Only gotoAndStop() and gotoAndPlay() take frame numbers.

Votes

Translate

Translate

Report

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 ,
Apr 23, 2017 Apr 23, 2017

Copy link to clipboard

Copied

I've done that but still not work.. the play head dos not move ..

When I add

  alert(this);

inside function myFunction() .. I get [Object window ] message..

The question still How Can I refer to the timeline to play the play head??

Votes

Translate

Translate

Report

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
LEGEND ,
Apr 24, 2017 Apr 24, 2017

Copy link to clipboard

Copied

LATEST

Event handlers default to executing in the global window context. Yes, this was a very poorly thought out design decision, but now we're stuck with it.

To force a function to execute in a specific context, you have to use .bind() on it.

Function.prototype.bind() - JavaScript | MDN

Votes

Translate

Translate

Report

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