做了一個flash視頻牆[附源檔案與xml檔案]_Flash As

來源:互聯網
上載者:User

作者:dickmao
as代碼:

複製代碼 代碼如下:

//design by dickmao 2007.1
fscommand("showmenu", "false");
import mx.managers.DepthManager;//載入類
item = 1;//計數器,載入動畫的個數
var mclListener = new Object();//偵聽載入動做完成的接聽程式
var mcLoader = new MovieClipLoader();//建立載入動畫的容器
mcLoader.addListener(mclListener);
function attachFlv() {//定義載入動畫的方法
    mcLoader.loadClip(myArray[item-1], this["b"+item].box.sit);//載入動畫(myArray是關於動畫名稱的數組)
    this["b"+item].box._visible = false;//先設定載入的動畫不可見,等完全載入再變為可見
    this["b"+item].box.sit._x = -54;//定義載入動畫的位置
    this["b"+item].box.sit._y = -39;
    this["b"+item].box._xscale = 0;
    this["b"+item].box._yscale = 0;
    this["b"+item].loadBar._visible = true;//loading條的可見設為真
    this["b"+item].textBar.itemName.text = nameArray[item-1];//讀入動畫的標題
    this["b"+item].textBar.itemName.setTextFormat(fnf);//設定標題文字的屬性為"fnf",fnf在下面會有定義
    this["b"+item].textBar.itemName._visible = false;//設定標題不可見
}
mclListener.onLoadInit = function() {//設定偵聽方法為載入完成
    if (item<flvTotal) {//當計數器小於動畫總數
        item++;//當前一個動畫載入完成,計數器加一,
        attachFlv();//繼續載入
    }
};
var fnf = new TextFormat();//定義fnf的屬性
fnf.align = "center";//置中
fnf.size = "9";//9px號字
fnf.color = 0xffffff;//白色
var xArray = new Array();//聲明數組,用來存放每個小螢幕的未知的
var yArray = new Array();
var flvTotal;
_global.myXml = new XML();//聲明全域變數:開始準備與xml檔案通訊咯
myXml.ignoreWhite = true;
myXml.load("http://vod.cntvs.com/video/videowall/list1.xml");//要讀哪個檔案呢?
_global.myArray = new Array();//存放動畫名稱的數組
_global.nameArray = new Array();//存放動畫標題的數組
_global.linkArray = new Array();//存放連結地址的數組
myXml.onLoad = function() {//載入xml的方法
    var e = myXml.firstChild.childNodes;//把xml裡的內容賦值給e
    flvTotal = e.length;//一共幾條內容呢?賦值給flvTotal吧
    for (var i = 0; i<flvTotal; i++) {
        myArray.push(e[i].attributes["title"]);//把xml檔案裡的title標籤內容放到myArray數組裡
        nameArray.push(e[i].attributes["name"]);//把xml檔案裡的name標籤內容放到nameArray數組裡
        linkArray.push(e[i].attributes["link"]);//把xml檔案裡的link標籤內容放到linkArray數組裡
    }
    attachFlv();//開始載入第一個動畫,因為這裡只執行一次
};
/////////////////////////////////////////////////////////////////////////////////
for (var i = 1; i<=35; i++) {//這裡就是開始壘方塊了,不解釋了
    butt = attachMovie("button", "b"+i, i);
    butt.loadBar._visible = false;
    if ((i>=1) && (i<=7)) {
        butt._x = 116+81*i;
        butt._y = 40-2;
    }
    if ((i>=8) && (i<=14)) {
        butt._x = 116+81*(i-7);
        butt._y = 101-2;
    }
    if ((i>=15) && (i<=21)) {
        butt._x = 116+81*(i-14);
        butt._y = 162-2;
    }
    if ((i>=22) && (i<=28)) {
        butt._x = 116+81*(i-21);
        butt._y = 223-2;
    }
    if ((i>=29) && (i<=35)) {
        butt._x = 116+81*(i-28);
        butt._y = 284-2;
    }
    xArray.push(butt._x);//把每個小螢幕的未知告訴數組,記錄起來
    yArray.push(butt._y);
    butt.n = i;//給小螢幕編個號,以後好找.
    butt.onRollOver = over;//當小螢幕被滑鼠經過就執行function over
    butt.onRollOut = out;//類似上面
    butt.onRelease = rele;//還是類似上面
}
function over() {//當滑鼠經過小螢幕時執行的方法
    _root.pressnumber = this.n;//到底滑鼠指到哪個小螢幕呢?前面編的號碼就派用場了.
    onEnterFrame = function () {
        _root["b"+pressnumber].setDepthTo(DepthManager.kTop);//把小螢幕放到最前面來.其他的螢幕表擋著.
        _root["b"+pressnumber]._xscale = 150-(150-_root["b"+pressnumber]._xscale)*.6;//放大小螢幕
        _root["b"+pressnumber]._yscale = 150-(150-_root["b"+pressnumber]._yscale)*.6;
        _root["Player"+pressnumber]._xscale = 150-(150-_root["Player"+pressnumber]._xscale)*.6;//內容也要放大
        _root["Player"+pressnumber]._yscale = 150-(150-_root["Player"+pressnumber]._yscale)*.6;
        for (var i = 1; i<36; i++) {//下面就是要讓沒事的小螢幕縮回去
            if (i<>_root.pressnumber) {
                _root["b"+i]._xscale = 100-(100-_root["b"+i]._xscale)*.6;
                _root["b"+i]._yscale = 100-(100-_root["b"+i]._yscale)*.6;
                _root["b"+i]._x = xArray[i-1]-(xArray[i-1]-_root["b"+i]._x)*.6;
                _root["b"+i]._y = yArray[i-1]-(yArray[i-1]-_root["b"+i]._y)*.6;
            }
        }
        if (_root["b"+pressnumber]._x<238) {//下面是讓擺在邊上的螢幕放大的時候別跑出框框
            _root["b"+pressnumber]._x = 217-(217-_root["b"+pressnumber]._x)*.6;
        }
        if (_root["b"+pressnumber]._x>650) {
            _root["b"+pressnumber]._x = 663-(663-_root["b"+pressnumber]._x)*.6;
        }
        if (_root["b"+pressnumber]._y<60) {
            _root["b"+pressnumber]._y = 53-(53-_root["b"+pressnumber]._y)*.6;
        }
        if (_root["b"+pressnumber]._y>260) {
            _root["b"+pressnumber]._y = 267-(267-_root["b"+pressnumber]._y)*.6;
        }
    };
}
function out() {//當滑鼠離開小螢幕時執行的方法
    onEnterFrame = function () {
        for (var i = 1; i<=36; i++) {//全部歸位!
            _root["b"+i]._xscale = 100-(100-_root["b"+i]._xscale)*.6;
            _root["b"+i]._yscale = 100-(100-_root["b"+i]._yscale)*.6;
            _root["b"+i]._x = xArray[i-1]-(xArray[i-1]-_root["b"+i]._x)*.6;
            _root["b"+i]._y = yArray[i-1]-(yArray[i-1]-_root["b"+i]._y)*.6;
        }
    };
}
function rele() {//當滑鼠點擊小螢幕時執行的方法
    _root.pressnumber = this.n;
    getURL(linkArray[pressnumber-1], "_blank");
}

XML列表檔案
複製代碼 代碼如下:

<?xml version="1.0" encoding="utf-8"?>
<flvLists>
 <item title="http://vod.cntvs.com/video/videowall/item/bahentie-second.swf"   name="藍頓疤痕貼"  link="http://www.cntvs.com/Product_detail.asp?ID=25"/>
 <item title="http://vod.cntvs.com/video/videowall/item/dazuifuzhu-second.swf"   name="大嘴福豬" link="http://www.cntvs.com/Product_detail.asp?ID=99"/>
 <item title="http://vod.cntvs.com/video/videowall/item/dv9800-second.swf"   name="美易拍DV9800" link="http://www.cntvs.com/Product_detail.asp?ID=13"/>
 <item title="http://vod.cntvs.com/video/videowall/item/fuguixing-second.swf"   name="富貴星無煙鍋" link="http://www.cntvs.com/Product_detail.asp?ID=30"/>
 <item title="http://vod.cntvs.com/video/videowall/item/null.swf"   name="U8版背背佳" link="http://www.cntvs.com/Product_detail.asp?ID=85"/>
 <item title="http://vod.cntvs.com/video/videowall/item/jianzhangle-second.swf"   name="健長樂膠囊" link="http://www.cntvs.com/Product_detail.asp?ID=94"/>
 <item title="http://vod.cntvs.com/video/videowall/item/null.swf"   name="08版背背佳" link="http://www.cntvs.com/Product_detail.asp?ID=86"/>
 <item title="http://vod.cntvs.com/video/videowall/item/jipinguowang-second.swf"   name="極品鍋王" link="http://www.cntvs.com/Product_detail.asp?ID=36"/>
 <item title="http://vod.cntvs.com/video/videowall/item/lewanjia-second.swf"   name="樂萬家無煙鍋" link="http://www.cntvs.com/Product_detail.asp?ID=32"/>
 <item title="http://vod.cntvs.com/video/videowall/item/liangliting(neiku)-second.swf"   name="靚立婷內褲" link="http://www.cntvs.com/Product_detail.asp?ID=26"/>
 <item title="http://vod.cntvs.com/video/videowall/item/null.swf"   name="U9版背背佳" link="http://www.cntvs.com/Product_detail.asp?ID=84"/>
 <item title="http://vod.cntvs.com/video/videowall/item/liangliting(neiyi)-second.swf"   name="靚立婷內衣" link="http://www.cntvs.com/Product_detail.asp?ID=28"/>
 <item title="http://vod.cntvs.com/video/videowall/item/duoduoxian-second.swf"   name="多多鮮保鮮盒" link="http://www.cntvs.com/Product_detail.asp?ID=41"/>
 <item title="http://vod.cntvs.com/video/videowall/item/liangliting(taozhuang)-second.swf"   name="靚立婷套裝" link="http://www.cntvs.com/Product_detail.asp?ID=10"/>
  <item title="http://vod.cntvs.com/video/videowall/item/liangliting(zhongku)-second.swf"   name="靚立婷中褲" link="http://www.cntvs.com/Product_detail.asp?ID=12"/>
 <item title="http://vod.cntvs.com/video/videowall/item/qingfengcheying-second.swf"   name="清風車影" link="http://www.cntvs.com/Product_detail.asp?ID=15"/>
 <item title="http://vod.cntvs.com/video/videowall/item/quban-second.swf"   name="藍頓美白祛斑" link="http://www.cntvs.com/Product_detail.asp?ID=20"/>
 <item title="http://vod.cntvs.com/video/videowall/item/null.swf"   name="多密發" link="http://www.cntvs.com/Product_detail.asp?ID=27"/>
 <item title="http://vod.cntvs.com/video/videowall/item/null.swf"   name="綠力咀嚼片大禮包" link="http://www.cntvs.com/Product_detail.asp?ID=98"/>
 <item title="http://vod.cntvs.com/video/videowall/item/qudou-second.swf"   name="藍頓祛痘組合" link="http://www.cntvs.com/Product_detail.asp?ID=21"/>
 <item title="http://vod.cntvs.com/video/videowall/item/xueyitong-second.swf"   name="學易通電子教師" link="http://www.cntvs.com/Product_detail.asp?ID=11"/>
 <item title="http://vod.cntvs.com/video/videowall/item/renshenwen-second.swf"   name=" 藍頓妊娠紋修護" link="http://www.cntvs.com/Product_detail.asp?ID=22"/>
 <item title="http://vod.cntvs.com/video/videowall/item/tingcai-second.swf"   name=" 婷采減肥靚顏" link="http://www.cntvs.com/Product_detail.asp?ID=40"/>
 <item title="http://vod.cntvs.com/video/videowall/item/null.swf"   name="瘦兒" link="http://www.cntvs.com/Product_detail.asp?ID=52"/>
 <item title="http://vod.cntvs.com/video/videowall/item/tingzi-second.swf"   name="挺姿矯正帶" link="http://www.cntvs.com/Product_detail.asp?ID=43"/>
 <item title="http://vod.cntvs.com/video/videowall/item/xianliting-second.swf"   name="纖麗婷矯形內衣" link="http://www.cntvs.com/Product_detail.asp?ID=42"/>
 <item title="http://vod.cntvs.com/video/videowall/item/xuexizhen-second.swf"   name="好學生學習枕" link="http://www.cntvs.com/Product_detail.asp?ID=93"/>
 <item title="http://vod.cntvs.com/video/videowall/item/null.swf"   name="可貝爾仿生面膜貼" link="http://www.cntvs.com/Product_detail.asp?ID=37"/>
 <item title="http://vod.cntvs.com/video/videowall/item/null.swf"   name="聯邦悠悠挺" link="http://www.cntvs.com/Product_detail.asp?ID=46"/>
 <item title="http://vod.cntvs.com/video/videowall/item/yilaida-second.swf"   name="伊萊達玫瑰唇筆" link="http://www.cntvs.com/Product_detail.asp?ID=18"/>
 <item title="http://vod.cntvs.com/video/videowall/item/zaiqingchun-second.swf"   name="再清椿" link="http://www.cntvs.com/Product_detail.asp?ID=29"/>
 <item title="http://vod.cntvs.com/video/videowall/item/zhoujixiao-second.swf"   name="藍頓祛皺組合" link="http://www.cntvs.com/Product_detail.asp?ID=24"/>
 <item title="http://vod.cntvs.com/video/videowall/item/liduofangzhou-second.swf"   name="利多方舟" link="http://www.cntvs.com/Product_detail.asp?ID=14"/>
 <item title="http://vod.cntvs.com/video/videowall/item/null.swf"   name="如煙電子煙" link="http://www.cntvs.com/Product_detail.asp?ID=87"/>
 <item title="http://vod.cntvs.com/video/videowall/item/null.swf"   name="唐龍眼保視康儀" link="http://www.cntvs.com/Product_detail.asp?ID=92"/>
</flvLists>

打包檔案下載

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.