Skip to main content
rickg1949
Known Participant
December 29, 2021
Question

PLEASE! getting back to menu when video is done

  • December 29, 2021
  • 2 replies
  • 607 views

I have used this code in the past to return to main menu of a simple HTML5 canvas video player interactive before but now it won't work. (actions layer code on video player frame)

this.stop();

var root = this;

this.movie01.on("added", function() {

$("#movie01").on("ended", function() {

movetoMenu();

});

});

function movetoMenu() {
console.log("go back to menu");
root.gotoAndStop(0);
}

 

What am I missing or doing wrong, PLEASE? Should be so simple.

    This topic has been closed for replies.

    2 replies

    rickg1949
    rickg1949Author
    Known Participant
    December 31, 2021

    Here is a simple test where the selected video just stops and animation does not return to menu:

     

    https://rickgodin.net/marla/test2.html 

     

    I tried with and without the [0] added to the function line mentioned above.

     

    I've attached fla file for your review. thanks, rg

     

    Please help.

    rickg1949
    rickg1949Author
    Known Participant
    December 31, 2021

    Here is fla file.

    kglad
    Community Expert
    Community Expert
    December 31, 2021

    i generally don't download and correct files unless i'm hired.  free help i offer via the adobe forums.

     

    that said, there's nothing wrong with my code (assuming you set everything up correctly), so i suggest you open the developer console and see if there's an error somewhere. 

     

    if there is no error, try using an older (than 2021 v.21 animate).  i'm seeing a video/code problem in animate 2022 v.22 and in animate 2021 v.21, but not in animate 2019 v.19.  2020 v.20 is available via adobe support and the bug may (or may not) exist in that version.

    kglad
    Community Expert
    Community Expert
    December 30, 2021

    $("#movie01")

     

    show be

     

    $("#movie01")[0]

    rickg1949
    rickg1949Author
    Known Participant
    December 30, 2021

    Is the [0] instead of .on in the line

     

    this.movie01.on("added", function() {

    kglad
    Community Expert
    Community Expert
    December 30, 2021

    no, it's the jquery name:

     

    this.stop();

    var root = this;

    this.movie01.on("added", function() {

    $("#movie01")[0].on("ended", function() {

    movetoMenu();

    });

    });

    function movetoMenu() {
    console.log("go back to menu");
    root.gotoAndStop(0);
    }