I have a script that plays a video when you roll over a button and stops and disappears when you roll out. However it does not rewind and will start to play mutiple times occasionally. Does anyone know what I can add to have it rewind automatically each time I roll out? Here is the script:
function onRolloverThr(event:MouseEvent):void
{
rmr.alpha = 0;
thrOval.x += 30;
var videoConnection:NetConnection = new NetConnection();
videoConnection.connect(null);
var videoStream:NetStream = new NetStream(videoConnection);
videoStream.play(“myvid.flv”);
var metaListener:Object = new Object();
metaListener.onMetaData = onMetaData;
videoStream.client = metaListener;
var video:Video = new Video();
video.attachNetStream(videoStream);
addChild(video);
video.x = 200;
video.y = 200;
video.alpha = 1;
function onMetaData(data:Object):void
{
thrOval.addEventListener(MouseEvent.CLICK, playMovie);
thrOval.addEventListener(MouseEvent.ROLL_OUT, allstop);
thrOval.addEventListener(MouseEvent.MOUSE_OUT, alphoutMovie);
}
function playMovie(event:MouseEvent):void
{
videoStream.play(“myvid.flv”);
}
function allstop(event:MouseEvent):void
{
videoStream.pause();
}
function alphoutMovie(event:MouseEvent):void
{
video.alpha = 0;
}
}
function onRolloutThr(event:MouseEvent):void
{
rmr.alpha = 1;
thrOval.x -= 30;
}
thrOval.buttonMode = true;