メニューバー

HOME HELP 新着記事 ツリー表示 スレッド表示 トピック表示 発言ランク ファイル一覧 検索 過去ログ

ツリー一括表示

Nomal ワイド動画編:AS3:XMLを読み込んで表示するプレーヤー /mitt (09/12/24(Thu) 04:00) [ID:vS2O7xY5] #315
Nomal videoPlay_auto.as /mitt (09/12/24(Thu) 04:04) [ID:vS2O7xY5] #316
  └Nomal videoPlay_auto.asのつづき /mitt (09/12/24(Thu) 04:05) [ID:vS2O7xY5] #317


親記事 / ▼[ 316 ]
■315 / 親階層)  ワイド動画編:AS3:XMLを読み込んで表示するプレーヤー
□投稿者/ mitt クラウンプライズ(63回)-(2009/12/24(Thu) 04:00:16) [ID:vS2O7xY5]
http://mitt3210.com
    最近撮影するビデオは、16:9(ワイド)なので、作ってみた。

    ただし、今回は静止画を使わず、動画の3秒目のフレームを使ってアイコン化する。
    ブロードバンドじゃない人には、ちょっときついかも。。

    動画は支障のないものに変えてあります。コメントと咬み合いませんが、お気になさらず。

    完成品は、こちら↓
    http://mitt3210.s39.coreserver.jp/UP/16-9/video.html

    表示に必要なファイル
    フォルダ構造は、キャッシュを見ればわかると思うので、割合。

    videoPlay.xml           //XMLファイル
    SkinUnderAllNoCaption.swf     //プレーヤースキン
    video.swf             //今回作ったプレーヤー
    1/0101.flv            //動画
    2/0202.flv
    3/0302.flv
    4/0402.flv
    5/0502.flv

    ポイント
    ・テキスト文字の 改行は"\n"、タブは"\t"、下記スクリプトは、"\n"と"\t "に書き換えられてしまったので注意。
    ・テキスト文字の "▲"が、下記スクリプトは、"▶"に書き換えられてしまったので注意。
    ・flv動画の大きさは640×380ピクセル。16:9です。
    ・videoPlay.xmlはこちら↓(開いたらソースを見て下さい)
    http://mitt3210.s39.coreserver.jp/UP/16-9/videoPlay.xml
     [0]が、item id="1"
     [1]が、item id="2"
     [2]が、item id="3"
     [3]が、item id="4"
     [4]が、item id="5"
    ・ライブラリーにFLVPlaybackを格納しておく。
    ・下記のスクリプトを、videoPlay_auto.asという名前で保存。
    ・プロパティータグの「ドキュメントクラス」のところに、videoPlay_autoと記述し、ASファイルを読み込む。


[ □ Tree ] 返信 削除キー/

▲[ 315 ] / ▼[ 317 ]
■316 / 1階層)  videoPlay_auto.as
□投稿者/ mitt クラウンプライズ(64回)-(2009/12/24(Thu) 04:04:54) [ID:vS2O7xY5]
http://mitt3210.com
    package {
    import fl.video.*;
    import flash.events.*;
    import flash.text.*;
    import flash.display.MovieClip;
    import flash.net.*;
    import flash.display.Sprite;

    public class videoPlay_auto extends Sprite {
    private var myLoader:URLLoader;
    private var videoNum:Number;
    private var video:Array = [];
    private var videoTitle:Array = [];
    private var videoContent:Array = [];
    private var videoTheme:Array = [];
    private var player = new FLVPlayback();
    private var videoPath:String;
    private var n:Number;
    private var infoBox = new TextField();
    private var myXML:XML;

    public function videoPlay_auto() {
    var infoBox:TextField = new TextField();
    with(infoBox) {x = 10;y = 20;width = 630;height = 30;}var info:TextFormat = new TextFormat();info.font = "_明朝";info.bold = true;info.color = 0xFFFFFF;info.size = 16; infoBox.defaultTextFormat = info;
    addChild(infoBox);

    var myXML:XML = new XML();
    var XML_URL:String = "videoPlay.xml";
    var myXMLURL:URLRequest = new URLRequest(XML_URL);
    var myLoader:URLLoader = new URLLoader(myXMLURL);
    myLoader.addEventListener("complete", xmlLoaded);
    function xmlLoaded(event:Event):void{
    myXML = XML(myLoader.data);
    var total:String = myXML.total.toString();
    var pskin:String = myXML.pskin.toString();
    var pskinCol:String = myXML.pskinCol.toString();
    var txtCol:String = myXML.txtCol.toString();
    var element:XML;
    for each (element in myXML..item){
    var flv:String = element.flv.toString();
    var videoTitle:String = element.videoTitle.toString();
    var videoContent:String = element.videoContent.toString();
    var videoTheme:String = element.videoTheme.toString();



    var thmb_mc:MovieClip = new MovieClip();
    addChild(thmb_mc);
    var flvP:FLVPlayback = new FLVPlayback();
    flvP.skin = null;
    flvP.source = myXML.channel.item.flv[0].toString();
    flvP.autoPlay = false;
    flvP.playheadTime = 0.3;
    flvP.fullScreenTakeOver = false;
    thmb_mc.addChild(flvP);
    with(thmb_mc) {x = 650;y = 10;scaleX = scaleY = 0.4;alpha = 0.2;}
    thmb_mc.buttonMode = true;
    thmb_mc.addEventListener(MouseEvent.ROLL_OVER, rollover);
    thmb_mc.addEventListener(MouseEvent.ROLL_OUT, rollout);
    thmb_mc.addEventListener(MouseEvent.CLICK, playStart);
    function rollover(event:MouseEvent):void {event.target.alpha = 1.0;alt.text = "◆"+myXML.channel.item.videoTitle[0]+"\n "+myXML.channel.item.videoContent[0]+"\n"+myXML.channel.item.videoTheme[0].toString();}
    function rollout(event:MouseEvent):void {event.target.alpha = 0.2;alt.text = "\n"+"\n".toString();}
    function playStart(event:MouseEvent) {player.source = myXML.channel.item.flv[0].toString();player.play();infoBox.text = "▶ "+myXML.channel.item.videoTitle[0]+"\t"+myXML.channel.item.videoContent[0]+"\t"+myXML.channel.item.videoTheme[0].toString();}


    var thmb_mc2:MovieClip = new MovieClip();
    addChild(thmb_mc2);
    var flvP2:FLVPlayback = new FLVPlayback();
    flvP2.skin = null;
    flvP2.source = myXML.channel.item.flv[1].toString();
    flvP2.autoPlay = false;
    flvP2.playheadTime = 0.3;
    flvP2.fullScreenTakeOver = false;
    thmb_mc2.addChild(flvP2);
    with(thmb_mc2) {x = 650;y = 105;scaleX = scaleY = 0.4;alpha = 0.2;}
    thmb_mc2.buttonMode = true;
    thmb_mc2.addEventListener(MouseEvent.ROLL_OVER, rollover2);
    thmb_mc2.addEventListener(MouseEvent.ROLL_OUT, rollout2);
    thmb_mc2.addEventListener(MouseEvent.CLICK, playStart2);
    function rollover2(event:MouseEvent):void {event.target.alpha = 1.0;alt2.text = "◆"+myXML.channel.item.videoTitle[1]+"\n "+myXML.channel.item.videoContent[1]+"\n"+myXML.channel.item.videoTheme[1].toString();}
    function rollout2(event:MouseEvent):void {event.target.alpha = 0.2;alt2.text = "\n"+"\n".toString();}
    function playStart2(event:MouseEvent) {player.source = myXML.channel.item.flv[1].toString();player.play();infoBox.text = "▶ "+myXML.channel.item.videoTitle[1]+"\t"+myXML.channel.item.videoContent[1]+"\t"+myXML.channel.item.videoTheme[1].toString();}


    var thmb_mc3:MovieClip = new MovieClip();
    addChild(thmb_mc3);
    var flvP3:FLVPlayback = new FLVPlayback();
    flvP3.skin = null;
    flvP3.source = myXML.channel.item.flv[2].toString();
    flvP3.autoPlay = false;
    flvP3.playheadTime = 0.3;
    flvP3.fullScreenTakeOver = false;
    thmb_mc3.addChild(flvP3);
    with(thmb_mc3) {x = 650;y = 200;scaleX = scaleY = 0.4;alpha = 0.2;}
    thmb_mc3.buttonMode = true;
    thmb_mc3.addEventListener(MouseEvent.ROLL_OVER, rollover3);
    thmb_mc3.addEventListener(MouseEvent.ROLL_OUT, rollout3);
    thmb_mc3.addEventListener(MouseEvent.CLICK, playStart3);
    function rollover3(event:MouseEvent):void {event.target.alpha = 1.0;alt3.text = "◆"+myXML.channel.item.videoTitle[2]+"\n "+myXML.channel.item.videoContent[2]+"\n"+myXML.channel.item.videoTheme[2].toString();}
    function rollout3(event:MouseEvent):void {event.target.alpha = 0.2;alt3.text = "\n"+"\n".toString();}
    function playStart3(event:MouseEvent) {player.source = myXML.channel.item.flv[2].toString();player.play();infoBox.text = "▶ "+myXML.channel.item.videoTitle[2]+"\t"+myXML.channel.item.videoContent[2]+"\t"+myXML.channel.item.videoTheme[2].toString();}


    var thmb_mc4:MovieClip = new MovieClip();
    addChild(thmb_mc4);
    var flvP4:FLVPlayback = new FLVPlayback();
    flvP4.skin = null;
    flvP4.source = myXML.channel.item.flv[3].toString();
    flvP4.autoPlay = false;
    flvP4.playheadTime = 0.3;
    flvP4.fullScreenTakeOver = false;
    thmb_mc4.addChild(flvP4);
    with(thmb_mc4) {x = 650;y = 295;scaleX = scaleY = 0.4;alpha = 0.2;}
    thmb_mc4.buttonMode = true;
    thmb_mc4.addEventListener(MouseEvent.ROLL_OVER, rollover4);
    thmb_mc4.addEventListener(MouseEvent.ROLL_OUT, rollout4);
    thmb_mc4.addEventListener(MouseEvent.CLICK, playStart4);
    function rollover4(event:MouseEvent):void {event.target.alpha = 1.0;alt4.text = "◆"+myXML.channel.item.videoTitle[3]+"\n "+myXML.channel.item.videoContent[3]+"\n"+myXML.channel.item.videoTheme[3].toString();}
    function rollout4(event:MouseEvent):void {event.target.alpha = 0.2;alt4.text = "\n"+"\n".toString();}
    function playStart4(event:MouseEvent) {player.source = myXML.channel.item.flv[3].toString();player.play();infoBox.text = "▶ "+myXML.channel.item.videoTitle[3]+"\t"+myXML.channel.item.videoContent[3]+"\t"+myXML.channel.item.videoTheme[3].toString();}


    var thmb_mc5:MovieClip = new MovieClip();
    addChild(thmb_mc5);
    var flvP5:FLVPlayback = new FLVPlayback();
    flvP5.skin = null;
    flvP5.source = myXML.channel.item.flv[4].toString();
    flvP5.autoPlay = false;
    flvP5.playheadTime = 0.3;
    flvP5.fullScreenTakeOver = false;
    thmb_mc5.addChild(flvP5);
    with(thmb_mc5) {x = 650;y = 390;scaleX = scaleY = 0.4;alpha = 0.2;}
    thmb_mc5.buttonMode = true;
    thmb_mc5.addEventListener(MouseEvent.ROLL_OVER, rollover5);
    thmb_mc5.addEventListener(MouseEvent.ROLL_OUT, rollout5);
    thmb_mc5.addEventListener(MouseEvent.CLICK, playStart5);
    function rollover5(event:MouseEvent):void {event.target.alpha = 1.0;alt5.text = "◆"+myXML.channel.item.videoTitle[4]+"\n "+myXML.channel.item.videoContent[4]+"\n"+myXML.channel.item.videoTheme[4].toString();}
    function rollout5(event:MouseEvent):void {event.target.alpha = 0.2;alt5.text = "\n"+"\n".toString();}
    function playStart5(event:MouseEvent) {player.source = myXML.channel.item.flv[4].toString();player.play();infoBox.text = "▶ "+myXML.channel.item.videoTitle[4]+"\t"+myXML.channel.item.videoContent[4]+"\t"+myXML.channel.item.videoTheme[4].toString();}
[ 親 315 / □ Tree ] 返信 削除キー/

▲[ 316 ] / 返信無し
■317 / 2階層)  videoPlay_auto.asのつづき
□投稿者/ mitt クラウンプライズ(65回)-(2009/12/24(Thu) 04:05:51) [ID:vS2O7xY5]
http://mitt3210.com

    var format:TextFormat = new TextFormat();format.color = myXML.txtCol.toString();format.size = 9;
    var alt:TextField = new TextField();
    with(alt) {x = 650;y = 0;width = 140;height = 45;wordWrap = true;} alt.defaultTextFormat = format;
    addChild(alt);
    var alt2:TextField = new TextField();
    with(alt2) {x = 650;y = 95;width = 140;height = 45;wordWrap = true;}alt2.defaultTextFormat = format;
    addChild(alt2);
    var alt3:TextField = new TextField();
    with(alt3) {x = 650;y = 190;width = 140;height = 45;wordWrap = true;}alt3.defaultTextFormat = format;
    addChild(alt3);
    var alt4:TextField = new TextField();
    with(alt4) {x = 650;y = 285;width = 140;height = 45;wordWrap = true;}alt4.defaultTextFormat = format;
    addChild(alt4);
    var alt5:TextField = new TextField();
    with(alt5) {x = 650;y = 380;width = 140;height = 45;wordWrap = true;}alt5.defaultTextFormat = format;
    addChild(alt5);


    player.skin = myXML.pskin.toString();
    player.skinBackgroundColor = myXML.pskinCol.toString();
    player.x = 0;
    player.y = 50;
    player.width = 640;
    player.height = 380;
    player.volume = 0.8;
    player.autoPlay = true;
    player.bufferTime = 0;
    n = 0;
    player.source = myXML.channel.item.flv[n].toString();
    videoNum = myXML.total.toString();
    addChild(player);
    player.play();
    infoBox.text = "▶ "+myXML.channel.item.videoTitle[n]+"\t"+myXML.channel.item.videoContent[n]+"\t"+myXML.channel.item.videoTheme[n].toString();

    }
    }
    function videoChange(event:VideoEvent) {
    if (n n++;
    player.source = myXML.channel.item.flv[n].toString();
    player.play();
    infoBox.text = "▶ "+myXML.channel.item.videoTitle[n]+"\t"+myXML.channel.item.videoContent[n]+"\t"+myXML.channel.item.videoTheme[n].toString();
    } else {
    n=0;
    player.source = myXML.channel.item.flv[n].toString();
    player.play();
    infoBox.text = "▶ "+myXML.channel.item.videoTitle[n]+"\t"+myXML.channel.item.videoContent[n]+"\t"+myXML.channel.item.videoTheme[n].toString();
    }
    }
    player.addEventListener(VideoEvent.COMPLETE, videoChange);
    }
    }
    }
[ 親 315 / □ Tree ] 返信 削除キー/


Mode/  Pass/

HOME HELP 新着記事 ツリー表示 スレッド表示 トピック表示 発言ランク ファイル一覧 検索 過去ログ

- Child Tree -