メニューバー

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

ツリー一括表示

Nomal 4個編:AS3:XMLを読み込んで表示するプレーヤー /mitt (09/12/10(Thu) 00:18) [ID:vS2O7xY5] #303
Nomal AS3:videoPlay_auto.as /mitt (09/12/10(Thu) 00:22) [ID:vS2O7xY5] #304


親記事 / ▼[ 304 ]
■303 / 親階層)  4個編:AS3:XMLを読み込んで表示するプレーヤー
□投稿者/ mitt クラウンプライズ(51回)-(2009/12/10(Thu) 00:18:27) [ID:vS2O7xY5]
http://mitt3210.com
    これは、プレイリストを4個表示します。
    外部jpgを読み込んで小さくし、アイコン化して、リンク貼ってあります。

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

    完成品は、こちら↓
    http://mitt3210.s39.coreserver.jp/UP/4-3/a/view.html

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

    videoPlay.xml              //XMLファイル
    SkinUnderAllNoCaption.swf     //プレーヤースキン
    view.swf             //今回作ったプレーヤー
    video1.flv             //動画
    video2.flv
    video3.flv
    video4.flv
    view1.jpg             //静止画
    view2.jpg
    view3.jpg
    view4.jpg

    ポイント
    ・テキスト文字の 改行は"\n"、タブは"\t"、下記スクリプトは、"\n"に書き換えられてしまったので注意。
    ・video*.flvとview*.jpgの大きさは640×480ピクセル。4:3画像です。
    ・videoPlay.xmlは前回の物と全く同じ。というか再利用。→No302,
     [0]が、item id="1"
     [1]が、item id="2"
     [2]が、item id="3"
     [3]が、item id="4"
    ・ライブラリーにFLVPlaybackを格納しておく。
    ・ライブラリーにUILoaderを格納しておく。
    ・下記のスクリプトを、videoPlay_auto.asという名前で保存。
    ・プロパティータグの「ドキュメントクラス」のところに、videoPlay_autoと記述し、ASファイルを読み込む。
[ □ Tree ] 返信 削除キー/

▲[ 303 ] / 返信無し
■304 / 1階層)  AS3:videoPlay_auto.as
□投稿者/ mitt クラウンプライズ(52回)-(2009/12/10(Thu) 00:22:42) [ID:vS2O7xY5]
http://mitt3210.com
    package {
    import fl.video.*;
    import flash.events.*;
    import flash.text.*;
    import fl.containers.UILoader;
    import flash.net.URLRequest;
    import flash.net.URLLoader;
    import flash.net.URLLoaderDataFormat;
    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 n:Number;
    private var infoBox = new TextField();
    private var aLoader1 = new UILoader();
    private var aLoader2 = new UILoader();
    private var aLoader3 = new UILoader();
    private var aLoader4 = new UILoader();
    private var myXML:XML;

    public function videoPlay_auto() {

    var infoBox:TextField = new TextField();
    with(infoBox) {x = 640;y = 10;width = 160;height = 85;wordWrap = true;}var info:TextFormat = new TextFormat();info.font = "_明朝";info.color = 0xFFFFFF;info.size = 10; 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 img:String = element.img.toString();
    var videoTitle:String = element.videoTitle.toString();
    var videoContent:String = element.videoContent.toString();
    var videoTheme:String = element.videoTheme.toString();

    var aLoade1r:UILoader = new UILoader();
    aLoader1.source = myXML.channel.item.img[0].toString();
    aLoader1.scaleContent = true;
    with (aLoader1) {
    x = 650;y = 70;scaleX = scaleY = 1.4;alpha = 0.7;
    }
    addChild(aLoader1);
    aLoader1.buttonMode = true;
    aLoader1.addEventListener(MouseEvent.ROLL_OVER, rollover);
    aLoader1.addEventListener(MouseEvent.ROLL_OUT, rollout);
    aLoader1.addEventLener(MouseEvent.CLICK, playStart);
    function rollover(event:MouseEvent):void {event.target.alpha = 1.0;alt.text = myXML.channel.item.videoContent[0]+"\n "+myXML.channel.item.videoTheme[0].toString();}
    function rollout(event:MouseEvent):void {event.target.alpha = 0.7;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]+"\n "+"\n "+myXML.channel.item.videoContent[0]+"\n "+"\n "+myXML.channel.item.videoTheme[0].toString();}

    var aLoade2r:UILoader = new UILoader();
    aLoader2.source = myXML.channel.item.img[1].toString();
    aLoader2.scaleContent = true;
    with (aLoader2) {
    x = 650;y = 178;scaleX = scaleY = 1.4;alpha = 0.7;
    }
    addChild(aLoader2);
    aLoader2.buttonMode = true;
    aLoader2.addEventListener(MouseEvent.ROLL_OVER, rollover2);
    aLoader2.addEventListener(MouseEvent.ROLL_OUT, rollout2);
    aLoader2.addEventListener(MouseEvent.CLICK, playStart2);
    function rollover2(event:MouseEvent):void {event.target.alpha = 1.0;alt2.text = myXML.channel.item.videoContent[1]+"\n "+myXML.channel.item.videoTheme[1].toString();}
    function rollout2(event:MouseEvent):void {event.target.alpha = 0.7;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]+"\n "+"\n "+myXML.channel.item.videoContent[1]+"\n "+"\n "+myXML.channel.item.videoTheme[1].toString();}

    var aLoade3r:UILoader = new UILoader();
    aLoader3.source = myXML.channel.item.img[2].toString();
    aLoader3.scaleContent = true;
    with (aLoader3) {
    x = 650;y = 286;scaleX = scaleY = 1.4;alpha = 0.7;
    }
    addChild(aLoader3);
    aLoader3.buttonMode = true;
    aLoader3.addEventListener(MouseEvent.ROLL_OVER, rollover3);
    aLoader3.addEventListener(MouseEvent.ROLL_OUT, rollout3);
    aLoader3.addEventListener(MouseEvent.CLICK, playStart3);
    function rollover3(event:MouseEvent):void {event.target.alpha = 1.0;alt3.text = myXML.channel.item.videoContent[2]+"\n "+myXML.channel.item.videoTheme[2].toString();}
    function rollout3(event:MouseEvent):void {event.target.alpha = 0.7;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]+"\n "+"\n "+myXML.channel.item.videoContent[2]+"\n "+"\n "+myXML.channel.item.videoTheme[2].toString();}

    var aLoade4r:UILoader = new UILoader();
    aLoader4.source = myXML.channel.item.img[3].toString();
    aLoader4.scaleContent = true;
    with (aLoader4) {
    x = 650;y = 394;scaleX = scaleY = 1.4;alpha = 0.7;
    }
    addChild(aLoader4);
    aLoader4.buttonMode = true;
    aLoader4.addEventListener(MouseEvent.ROLL_OVER, rollover4);
    aLoader4.addEventListener(MouseEvent.ROLL_OUT, rollout4);
    aLoader4.addEventListener(MouseEvent.CLICK, playStart4);
    function rollover4(event:MouseEvent):void {event.target.alpha = 1.0;alt4.text = myXML.channel.item.videoContent[3]+"\n "+myXML.channel.item.videoTheme[3].toString();}
    function rollout4(event:MouseEvent):void {event.target.alpha = 0.7;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]+"\n "+"\n "+myXML.channel.item.videoContent[3]+"\n "+"\n "+myXML.channel.item.videoTheme[3].toString();}


    var format:TextFormat = new TextFormat();format.color = myXML.txtCol.toString();format.size = 9;
    var alt:TextField = new TextField();
    with(alt) {x = 645;y = 85;width = 160;height = 30;wordWrap = true;} alt.defaultTextFormat = format;
    addChild(alt);
    var alt2:TextField = new TextField();
    with(alt2) {x = 645;y = 193;width = 160;height = 30;wordWrap = true;} alt2.defaultTextFormat = format;
    addChild(alt2);
    var alt3:TextField = new TextField();
    with(alt3) {x = 645;y = 301;width = 160;height = 30;wordWrap = true;} alt3.defaultTextFormat = format;
    addChild(alt3);
    var alt4:TextField = new TextField();
    with(alt4) {x = 645;y = 409;width = 160;height = 30;wordWrap = true;} alt4.defaultTextFormat = format;
    addChild(alt4);

    player.skin = myXML.pskin.toString();
    player.skinBackgroundColor = myXML.pskinCol.toString();
    player.x = 0;
    player.y = 0;
    player.width = 640;
    player.height = 480;
    player.volume = 0.8;
    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]+"\n "+"\n "+myXML.channel.item.videoContent[n]+"\n "+"\n "+myXML.channel.item.videoTheme[n].toString();
    }
    }
    function videoChange(event:VideoEvent) {
    if (n n++;
    player.source = myXML.channel.疛tem.flv[n].toString();
    player.play();
    infoBox.text = myXML.channel.item.videoTitle[n]+"\n "+"\n "+myXML.channel.item.videoContent[n]+"\n "+"\n "+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]+"\n "+"\n "+myXML.channel.item.videoContent[n]+"\n "+"\n "+myXML.channel.item.videoTheme[n].toString();
    }
    }
    player.addEventListener(VideoEvent.COMPLETE, videoChange);
    }
    }
    }
[ 親 303 / □ Tree ] 返信 削除キー/


Mode/  Pass/

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

- Child Tree -