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

Load a Button after Video Ends in Canvas

Community Beginner ,
Feb 24, 2021 Feb 24, 2021

Copy link to clipboard

Copied

Hello,
I have read though several posts relating this this topic, but can not get a button to load after the end of a video.

Objective:

To detect the end of a MP4 video imported into the fist frame of timeline and once the end of video is reached a button displays (or advances timeline one frame to where a button resides so user can be linked to another page).

Thanks in advance.
Charlie


TOPICS
ActionScript , Code , How to , Timeline

Views

279

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

Community Expert , Feb 25, 2021 Feb 25, 2021

then the video's not imported "into the first frame of the timeline".  it's imported using the video component.

 

so, if your component instance name is videoPlayer, you can use:

 

var video;
function checkInitF() {
if (video) {
video.addEventListener("ended", function(){
// video ended. do whatever
});
} else {
video = $("#videoPlayer")[0];
setTimeout(checkInitF, 100);
}
}
checkInitF();

 

 

kglad_0-1614265343654.png

 

Votes

Translate

Translate
Community Expert ,
Feb 24, 2021 Feb 24, 2021

Copy link to clipboard

Copied

if the video's on a timeline, start a timer loop (eg, ticker if html5, enterframe if as3) and repeatedly check if the last frame has played.  if it has, stop the loop and do what with that 

 

or even easier, just put a this.stop() on the last frame of the video or one frame beyond the video (if that's what you want) and put your button there.

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
Community Beginner ,
Feb 24, 2021 Feb 24, 2021

Copy link to clipboard

Copied

Hi Kglad.

Thanks for the kind reply.

Those options make a lot of sense and certainly valid if the video is set across the root timeine. I'll further clarrify my situation:

I had to import the video using the Video Component and that places the entire video  (1:59 in length) in the first keyframe as a self-contained video component. I'm under the impression that I need to do it this way to make it HTML5 Canvas compatible. (See image to viw how it is setup)

Any thoughts or maybe I'm misundertanting your answer. Or, my Animate skills are far where they shoud be. : )

Thanks,
Charlie

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
Community Expert ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

then the video's not imported "into the first frame of the timeline".  it's imported using the video component.

 

so, if your component instance name is videoPlayer, you can use:

 

var video;
function checkInitF() {
if (video) {
video.addEventListener("ended", function(){
// video ended. do whatever
});
} else {
video = $("#videoPlayer")[0];
setTimeout(checkInitF, 100);
}
}
checkInitF();

 

 

kglad_0-1614265343654.png

 

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
Community Beginner ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

Thank you very much.

I will give this a try.

C

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
Community Beginner ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

Hi.

That works perfectly.
You rock!

Charlie

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
Community Expert ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

LATEST

you're welcome.

 

p.s.  mark that answer as correct and others will more easily find  it. 

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