I see that this question has been asked and answered a few times here, but, for the life of me, I just can’t get this to work in my composition.
I want to trigger an action when a video is done playing. My talents lean more towards the design side than the programming side, so a lot of this is new to me.
I have a video group named “eot_sast_vd” in a symbol named “MovieAndBG_Sym,” which is the only symbol on my stage.
I’ve added alerts in the code to help me troubleshoot the issues.
I have tried:
var myVideo = document.getElementById('eot_sast_vd');
alert(myVideo); // always comes up “Null”
myVideo.addEventListener("ended", function(){
alert("in the function"); //never comes up
});
Then the whole composition comes to a grinding halt and nothing further happens.
Also, I’ve Tried
var vid = sym.$(‘eot_sast_vd’);
alert(vid) // displays “ [object Object] “
var vidEnd = $(vid).children().first();
alert(vidEnd) // displays “ [object Object] “
$(vidEnd).bind('ended', function () {
alert(“I am now in the function”) //never comes up
});
Then the composition, again, comes to a grinding halt and nothing further happens.
In addition, I’ve tried adding both these lines of codes to the stage’s “Composition Ready,” and “Creation Complete.”
Also the symbol “MovieAndBG_Sym’s” “Creation Complete” and even a timeline trigger on it’s timeline.
Any help would be greatly appreciated.