如何在下一场景AS3中删除流视频

时间:2013-08-28 09:45:16

标签: actionscript-3

我正在制作一个带有场景中视频的项目,但是当我进入下一个场景时,视频会不断出现。我该如何删除它。

到目前为止我的代码是:

import flash.net.NetConnection;
import flash.net.NetStream;
import flash.media.Video;
import flash.events.MouseEvent;


var videoConnection:NetConnection = new NetConnection();
videoConnection.connect(null);
var videoStream:NetStream = new NetStream(videoConnection);
videoStream.play("short_jump.flv");
var metaListener:Object = new Object();
metaListener.onMetaData = onMetaData;
videoStream.client = metaListener;
var video:Video = new Video();
video.attachNetStream(videoStream);
stage.addChild(video);
video.x=200;

function onMetaData(data:Object):void
{
play_btn.addEventListener(MouseEvent.CLICK, playMovie);
stop_btn.addEventListener(MouseEvent.CLICK, stopMovie);
}

function playMovie(event:MouseEvent):void
{
videoStream.play("short_jump.flv");
}

function stopMovie(event:MouseEvent):void
{
videoStream.pause();
}

感谢您的支持!

1 个答案:

答案 0 :(得分:0)

video.attachCamera(null)停止音频和视频,但最后一帧仍保留在视频中。你之后应该只是video.visible = false所以你没有看到那个框架。有一个错误,clear()没有做它应该做的事情。