入门极好视频: http://www.enet.com.cn/eschool/video/flashas3/
《Flash CS3 AS3声音视频高级编程》共分为两章:第一章深入讲解了FLASH对于声音的编程,最后通过一个功能强大的MP3播放器进行演示,通过这一章的学习可以让你对于声音的处理有一个深入的掌握;第二章深入讲解了对于视频的处理,包括如何使用现有视频组件来控制视频。同时还讲了如何创建自己的控制外观。
声音示例:
[AS3.0编程教学]最全的声音控制方法
http://jingyan.baidu.com/article/a948d651bc90a60a2ccd2e4c.html
视频示例: http://www.cuplayer.com/player/PlayerCodeCourse/2012/0914409.html
[Flex]NetStream动态加载视频利用SoundTransform控制音量
- <?xml version="1.0" encoding="utf-8"?>
- <!-- http://blog.flexexamples.com.sixxs.org/2008/03/01/displaying-a-video-in-flex-using-the-netconnection-netstream-and-video-classes/ -->
- <mx:Application xmlns:mx="http://www.adobe.com.sixxs.org/2006/mxml"
- layout="vertical"
- verticalAlign="middle"
- backgroundColor="white"
- viewSourceURL="srcview/index.html" xmlns:local="*"
- initialize="init();">
- <mx:Script>
-
<![CDATA[
-
import mx.controls.Alert;
-
private var urlArr:Array=["http://221.122.36.143.sixxs.org/oa/video/1.flv", "http://221.122.36.143/oa/video/2.flv", "http://221.122.36.143/oa/video/p2.mp4"];
-
public function init():void{
-
myVideo.urlArr = urlArr;
-
myVideo.total = 100000;
-
// Alert.show("1==>>"+myVideo.urlArr.length);
-
}
-
- ]]>
- </mx:Script>
- <local:mVideo id="myVideo"/>
- </mx:Application>
- 第二个文件
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Panel xmlns:mx="http://www.adobe.com.sixxs.org/2006/mxml"
- creationComplete="setTransformVolume();">
- <mx:Script>
-
<![CDATA[
-
import mx.controls.Alert;
-
import mx.events.SliderEvent;
-
private var nc:NetConnection;
-
private var ns:NetStream;
-
private var nc2:NetConnection;
-
private var ns2:NetStream;
-
private var video:Video;
-
[Bindable]
-
public var urlArr:Array=null;
-
[Bindable]
-
public var total:Number=0;
-
private var count:int=0;
-
private var finished1:int=1; //1:播放正在进行;0:播放结束
-
private var finished2:int=0; //1:播放正在进行;0:播放结束
-
private var volumeTransform:SoundTransform;
-
-
private function setTransformVolume():void{
-
volumeTransform=new SoundTransform();
-
slider.value = volumeTransform.volume;
-
slider.tickInterval = slider.snapInterval;
-
slider.liveDragging = true;
-
slider.addEventListener(Event.CHANGE, volumeChangeHandler);
-
init();
-
}
-
-
private function init():void
-
{
-
Alert.show("" + total);
-
-
var nsClient:Object={};
-
nc=new NetConnection();
-
nc.connect(null);
-
ns=new NetStream(nc);
-
ns.play(urlArr[count]);
-
ns.client=nsClient;
-
ns.soundTransform=volumeTransform;
-
ns.addEventListener(NetStatusEvent.NET_STATUS, myTest1);
-
-
video=new Video();
-
video.name="video1";
-
video.width=uic.width;
-
video.height=uic.height;
-
video.attachNetStream(ns);
-
if (uic.getChildByName("video1") != null)
-
{
-
uic.removeChild(uic.getChildByName("video1"));
-
}
-
count++;
-
}
-
private function volumeChangeHandler(event:SliderEvent):void {
-
volumeTransform.volume = slider.value;
-
ns.soundTransform = volumeTransform;
-
ns2.soundTransform = volumeTransform;
-
}
-
private function init2():void
-
{
-
var nsClient:Object={};
-
nc2=new NetConnection();
-
nc2.connect(null);
-
ns2=new NetStream(nc2);
-
ns2.play(urlArr[count]);
-
ns2.client=nsClient;
-
ns2.soundTransform=volumeTransform;
-
ns2.addEventListener(NetStatusEvent.NET_STATUS, myTest2);
-
-
video=new Video();
-
video.name="video2";
-
video.width=uic.width;
-
video.height=uic.height;
-
video.attachNetStream(ns2);
-
if (uic.getChildByName("video2") != null)
-
{
-
uic.removeChild(uic.getChildByName("video2"));