雖然以前也有想過要從youtube下載影片
不過反正bt更好用所以都只有想想
這次為了做一個像是http://www.123securityproducts.com/realtime-page.html的flash
需要先拿個flv當source(為啥公司會連一個可以用的都沒有也真令人費解@@)
而且flash也不能在as中動態變更fps
非得在轉檔的時候就轉好才行
剛好就在重灌狂人那兒找到這一篇
不過那個網頁轉出來的avi檔怪怪的
所以還是轉成mov檔後再用flash video encoder轉回3fps~30fps的flv檔
如果說有KMPlayer的話,下載Youtube Video Downloader來看比較實在
接下來又是複習時間啦
- 動態載入flvplayback
- 影片撥玩自動重撥
- 把movieClip的buttonMode設成true設成true後必需要加一行mouseChildren = false;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | import fl.video.FLVPlayback; import fl.video.VideoEvent; var flvArr:Array = new Array("","3fps","7.5fps","15fps","30fps"); var flvstr:String = ".flv"; var kumiArr:Array = new Array("",[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]); var t1:TextField = new TextField(); var t2:TextField = new TextField(); var t_fmt:TextFormat = new TextFormat(null,14,0xff6600); t1.x = 16; t2.x = 271; t1.y = t2.y = 175; t1.height = t2.height = 30; t1.width = t2.width = 50; for (var i=1; i<=6; i++) { var flvstr1:String = flvArr[kumiArr[i][0]]; var flvstr2:String = flvArr[kumiArr[i][1]]; var bt:MovieClip = this["b" + i]; bt.nt_txt.text= flvstr1+"&"+flvstr2; bt.stop(); bt.buttonMode = true; bt.mouseChildren = false; bt.addEventListener(MouseEvent.CLICK,chang); } function chang(e:MouseEvent) { var obj = e.target; var flvstr1:String = flvArr[kumiArr[obj.name.substr(1,1)][0]]; var flvstr2:String = flvArr[kumiArr[obj.name.substr(1,1)][1]]; flvPlay(flvstr1,flvstr2); } function flvPlay(s1:String,s2:String) { if (flv1) { this.removeChild(flv1); this.removeChild(flv2); } var flv1:FLVPlayback = new FLVPlayback(); var flv2:FLVPlayback = new FLVPlayback(); t1.text = s1; t2.text = s2; t1.setTextFormat(t_fmt); t2.setTextFormat(t_fmt); flv1.width = 240; flv1.height = 180; flv2.width = 240; flv2.height = 180; flv1.x= 15; flv1.y=15; flv2.x= 270; flv2.y=15; flv1.source = s1+flvstr; flv2.source = s2+flvstr; this.addChild(flv1); this.addChild(flv2); this.addChild(t1); this.addChild(t2); flv1.playWhenEnoughDownloaded(); flv2.playWhenEnoughDownloaded(); flv1.addEventListener( VideoEvent.COMPLETE,replay); flv2.addEventListener( VideoEvent.COMPLETE,replay); } function replay(e:VideoEvent) { e.target.play(); } |