Copy link to clipboard
Copied
Bonjour à toutes et tous,
passage obligé à Canvas, je n'arrive pas à trouver des exemples de codes basiques qui me permettent de faire ce que je faisains en AS3 pour FlashPlayer.
C'est relativement simple, je crée une anim qui s'arrête à la frame 73 où un bouton "vidéo" apparait.
Ce bouton renvoi vers la frame 220 où j'ai placé un composant vidéo qui lit un mp4.
j'ai pu trouver le fragment de code pour faire cette action simple.
Maintenant je souhaite que sur cette frame 220, je puisse placer un nouveau bouton "retour" qui permette de stopper la lecture du mp4 et retourner à la frame 73. Je n'y arrive pas et j'ai vraiment besoin d'aide.
Merci d'avance à qui pourra solutionner mon problème 🙂
Copy link to clipboard
Copied
this.return.addEventListener("click",returnF.bind(this));
function returnF(){
$("#your_video_instance_name")[0].pause(); // replace your_video_instance_name
this.gotoAndStop(73); // this should look like frame 74 on the timeline
}
Copy link to clipboard
Copied
Hi
thanks for the answer. I found the fix to my issue just right now before I see your answer.
Indeed the actions I wrote failed due to the number I used for the frames ! I didn't properly understand the number I had to set for the frame where I wanted the timeline go to and stop to play the video. Same misunderstand for the go back to the start on the "back" button.
I just placed a button on the 1rst frame which action is a stop then gotoandstop at frame 219 (not 220 where the video clip is actually)
And at frame 220 another button with action stop then gotoandstop at frame 0 (not 1)
I used the canvas code fragment provided with Animate and just changed the numbers for each frame where to go.
It works fine now !!
Copy link to clipboard
Copied
you're welcome