Actionscript 3 流式音频和视频AS3
我有几段视频正在播放。我从Actionscript 3 流式音频和视频AS3,actionscript-3,flash,Actionscript 3,Flash,我有几段视频正在播放。我从video_1.flv开始,在它完成之后,video_2.flv运行并循环,直到用户采取一些操作来播放其他电影,例如video_3.flv。所以我需要在后台播放video_2.flv时播放音频文件sound.mp3witch将被循环,这是我设法做到的。但我需要两个独立运行。因为现在当视频循环时,音频循环到。我只需要在播放video_2.flv时播放音频。多谢各位 var nc:NetConnection = new NetConnection(); nc.connect
video_1.flv
开始,在它完成之后,video_2.flv
运行并循环,直到用户采取一些操作来播放其他电影,例如video_3.flv
。所以我需要在后台播放video_2.flv
时播放音频文件sound.mp3
witch将被循环,这是我设法做到的。但我需要两个独立运行。因为现在当视频循环时,音频循环到。我只需要在播放video_2.flv
时播放音频。多谢各位
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
loader.vid.Video_1.attachNetStream(ns);
var listener:Object = new Object();
listener.onMetaData = function(evt:Object):void {};
ns.client = listener;
ns.play("http://media.easyads.bg/ads/display_ads_richmedia/video/avon/maria_ilieva/video_1.flv");
ns.addEventListener(NetStatusEvent.NET_STATUS, NCListener);
var clipTimer:Timer = new Timer(4000);
function NCListener(e:NetStatusEvent){
if (e.info.code == "NetStream.Play.Stop") {
ns.play("http://media.easyads.bg/ads/display_ads_richmedia/video/avon/maria_ilieva/video_2.flv");
sound.load(req);
shaker(null);
}
};
var sound:Sound = new Sound();
var soundChannel:SoundChannel;
var req:URLRequest = new URLRequest("sound.mp3");
sound.addEventListener(Event.COMPLETE, onSoundLoadComplete);
function onSoundLoadComplete(e:Event):void{
sound.removeEventListener(Event.COMPLETE, onSoundLoadComplete);
soundChannel = sound.play();
soundChannel.addEventListener(Event.SOUND_COMPLETE, onSoundChannelSoundComplete);
}
function onSoundChannelSoundComplete(e:Event):void{
e.currentTarget.removeEventListener(Event.SOUND_COMPLETE, onSoundChannelSoundComplete);
soundChannel = sound.play();
}
loader.button_01.addEventListener(MouseEvent.CLICK, play_video_01);
loader.button_01.addEventListener(MouseEvent.ROLL_OVER, play_effect_01);
function play_video_01 (event:MouseEvent){
clipTimer.stop();
ns.play("http://media.easyads.bg/ads/display_ads_richmedia/video/avon/maria_ilieva/video_3.flv");
loader.button_01_mc.gotoAndPlay (41);
}
也许本教程对你有帮助。。。 我是AS的新手,但我更喜欢把整个s。。。。填充到(可重用)类中 问候
Gee虽然此链接可以回答问题,但最好在此处包含答案的基本部分,并提供链接供参考。如果链接页面发生更改,只有链接的答案可能会无效。很好,但您知道的时间…:-/我会努力遵循你的想法。