PDA

View Full Version : looping flv's


benhg
12-29-2007, 09:00 AM
hello,

i am trying to have a flv loop continuously, but i cant figure it out. Here is my code:

var videoConnection:NetConnection = new NetConnection();
var videoStream:NetStream;
var md_obj:Object = new Object();
var bgVideo:Video = new Video();

videoConnection.connect(null);
videoStream = new NetStream(videoConnection);
bgVideo.attachNetStream(videoStream);

md_obj.onMetaData = metaData;

videoStream.client = md_obj;
videoStream.play("flv/sp_backgroundVideo01.flv");

bgVideo_mc.addChild(bgVideo);

Now i have tried adding this code:

videoStream.addEventListener(VideoEvent.COMPLETE, loopVideo);

function loopVideo(event:VideoEvent):void {
videoStream.play();
}

but i keep getting this error:

1046: Type was not found or was not a compile-time constant: VideoEvent.

i have also tried adding both of these lines at the start:

import fl.video.*;
import fl.video.VideoEvent;

can anyone help me?

Thanks

fentunfont
12-29-2007, 10:22 PM
what environment are you creating this project in?

i use flashdevelop a lot and when i want to use video compontents, i usually have to add the path to the fl.video elements in my classpaths.

these are located inside your flash cs3 directory. i cant remember precisely where but just navigate to that directory, then do a search for "videoevent.as"

as the directory that contains this file to your projects classpath.

darrellgrundy
04-13-2008, 03:19 AM
yeah ... I was pulling my hair out all yesterday trying to get this to work on Flex 3 / ActionScript 3.0 ... I stumbled on the answer when the Flex debugger threw up the VideoPlayer.as source (in response to a'.flv video not found error') and in there you can see that you need to import the following:

import mx.events.VideoEvent;

... and then add the listener as follows:

{flvVideoID}.addEventListener(VideoEvent.COMPLETE, rewindAndPlay);

... and then in my case when I defined the <mx:VideoDisplay... I set the parameter for autoRewind = "true", leaving only a simple function needed for the rewindAndPlay function something like:

private function rewindAndPlay(event:VideoEvent):void {
{flvVideoID}.play();
}

Hope that is useful to others hitting the same problem.

DG