Play video at a certain frame and loop it [AS3][FLVComponent]
I'm trying to achive some functionality on my flash file but I think I'm missing few things, let's see if someone can help me:
I have a Movieclip that contains a movieclip with an animation and a FLV component that holds a video loaded externally.
The objective is to play the video in between the Movieclip animation and when that animation starts again, play again as well the video.
At the point where I am, the video only play once, but after the animation starts again, the video seems to not be available anymore.. or there's some error on the Event Listener I'm using to play again the video.
Inside the animation I have that code:
That code play the video once, as I said. But the next time the animation goes trough that frame, the video doesn't start again.
Notice that I have a Cue Point listener that reads the cuepoints. Using that, at the end of the video I stop it and seek to 0 (after that starts again the animation).
Does anyone realise why the video doesn't play after the first time was called?
Any help will be apreciate, thank you!
i am afraid i can not exactly follow you from your explanation.
however, you should be able to do what i think you want, by using both Event.ENTER_FRAME, and VideoEvent.COMPLETE.
a few other points: do not place your code inside of movieclips. keep all of your code at the root of the project. it is best to keep the code at the top level and target clips and nested clips downwards, referencing them directly (it is always easier, to call downwards to clips rather than back up…).
if you want you can look at this simple .fla which should be able to be reworked for your purpose.
the full code is:
where 'mc1' is a movieclip which has inside of it 'mc2' which is a movieclip with an animation. it also has 'myVid' which is an FLV Playback Component.
outside of 'mc1' is a button 'startBtn' which begins the whole sequence.
i hope that helps out
Thank you Demetri for that extense explanation!
I'd explained my self wrong due my english, excuse me :_)
I've got my video already playing, the problem is that only play the first time the animation play. When the animation loop (start again from the beginning) the video doesn't play again..
My timeline starts with 4seconds of animation, then starts a video for other 4seconds and after the video ends the animation stills running for other 3 seconds and achieve the end of the whole animation. After that, starts again from the beginning, but the video will be not played again.
The video needs to start when the animation achieve the specific frame not why any other interaction like the MouseEvent, a button or the end of the video itself.
Using an ENTER_FRAME event listener I was trying to achieve that: play the video everytime the timeline run that specific frame.
But as I said seems the video doesn't rewind or simple desapear...
Well, seems a tricky issue. Thanks for your reply anyway ;)
Well finnaly I've solved the issue. I'm going to try a proper explanation:
I was playing a video with an FLV component. When the whole animation was playing again as a loop, the video doesn't.
I've realised that when you load and play a video into the FLV Component it keeps loaded then in the case of the loop the only action needs to be done is to play the video element without loading again the movie.
Inside the animation I've put that piece of code, first to load and then to just play the video is already loaded:
The code that didn't work on the same frame was (didn't work cause was playing the video just once):
And with a Cue point or a VideoEvent listener I'd stoped the video and rewind to 0.
Anyway, already solved =)