PDA

View Full Version : Video playback


Tezread
02-18-2004, 07:31 AM
I cant seem to find any tutorials on video playback. I would like to import and MPG movie and create play/pause/ff/ and rewind buttons- any signposts you could give me guys?

Ruben
02-18-2004, 01:18 PM
Well, I guess the reasons there aren't any tutes on it are:
1. People don't often do it because flash is a vector-program, using too many pixels [which can easily be achieved when you work with video's] results in ****ed up sizes.
2. And secondly: Importing mpg's is as easy as ****...

But here we go anyway:

Just create an empty movieclip, in this example we'll give it the instance-name "someclip"

Then create some buttons [on the _root] with and put this script on the _root:


playButton.onRelease=function(){
someclip.play()
}
pauseButton.onRelease=function(){
someclip.stop()
}
stopButton.onRelease=function(){
someclip.gotoAndStop(1)
}
stepbackwardButton.onRelease=function(){
someclip.gotoAndStop(someclip._currentframe-1)
}
stepforwardButton.onRelease=function(){
someclip.gotoAndStop(someclip._currentframe+1)
}

streets
02-18-2004, 09:02 PM
i'm fairly new to all this, and i've been trying to get this to work for hours but haven't had any luck at all. could someone please have a look at my .fla file and tell me what i've done wrong, i changed a little of the code as i only need play & pause. i've also linked to the video (.mov), is that ok? I added an .flv version of the video in there too (just in case you need it), which i can't get to play at all...?

thanks

s

streets
02-18-2004, 09:03 PM
it won't let me attach the file???

streets
02-18-2004, 09:26 PM
i uploaded the file to my space (minus the flv) to here (http://www.ethixdesign.com/help.zip). any help would be appreciated.

Ruben
02-19-2004, 11:37 AM
Streets -> great movie, I was able to solve the problem partually. I found a away to do the video-playback and stuff, but I couldn't get the audio included. But here here's a zip with what I got so far for starters. I'll break my mind over the audio-part, maybe it has something to do with using a quicktime-movie...

By the way: great movie, liked it ;)

- Ruben

Ruben
02-19-2004, 11:50 AM
Damn! They won't let me attach the zip!

OK: I'll try to explain what you did wrong with the video-thing...

1. Just remove the video from the library and remove the video from the stage
2. Create a new and empty movieclip on the stage and give it the instance-name 'videoClip'
3. When you're in the new movieclip go to
[file]
[import]
[import to stage]
and select the file [video.mov]
4. Then go through all the steps and select:
'Embed video in...' and 'Import the entire video'
5. After that you'll get a window that tells you that the video requires 600 frames, click yes.
6. On the _root, put the following script:

_root.screennotblackanymore=30
videoClip.stop()
playButton.onRelease=function(){
if (videoClip._currentframe<_root.screennotblackanymore){
videoClip.gotoAndPlay(_root.screennotblackanymore)
}else{
videoClip.play()
}
}
pauseButton.onRelease=function(){
videoClip.stop()
}

7. On the last frame [frame600] of a new and empty layer in the video-movieclip paste this script:

gotoAndStop(_root.screennotblackanymore)


That should do it for the video-part. As I said: I'll think about the audio-part...

Good luck - Ruben

streets
02-19-2004, 07:46 PM
thanks for the help ruben, i've got the video playing but the buttons don't work?
so a few questions:
-what should the layer with the videoClip be called?
-should the buttons be in the main scene (called "_root") with the script attached to the first frame?

thanks again

s

Ruben
02-20-2004, 12:46 PM
I read your PM, I mailed you the sample a few seconds ago... ;)

- Ruben