做了一個flash視頻墻[附源文件與xml文件]
更新時間:2007年03月16日 00:00:00 投稿:mdxy-dxy
這篇文章主要介紹了做了一個flash視頻墻[附源文件與xml文件]
作者:dickmao
as代碼:
復(fù)制代碼 代碼如下:
//design by dickmao 2007.1
fscommand("showmenu", "false");
import mx.managers.DepthManager;//載入類
item = 1;//計數(shù)器,載入動畫的個數(shù)
var mclListener = new Object();//偵聽載入動做完成
var mcLoader = new MovieClipLoader();//新建載入動畫的容器
mcLoader.addListener(mclListener);
function attachFlv() {//定義加載動畫的方法
mcLoader.loadClip(myArray[item-1], this["b"+item].box.sit);//載入動畫(myArray是關(guān)于動畫名稱的數(shù)組)
this["b"+item].box._visible = false;//先設(shè)置載入的動畫不可見,等完全載入再變?yōu)榭梢?br /> 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條的可見設(shè)為真
this["b"+item].textBar.itemName.text = nameArray[item-1];//讀入動畫的標(biāo)題
this["b"+item].textBar.itemName.setTextFormat(fnf);//設(shè)置標(biāo)題文字的屬性為"fnf",fnf在下面會有定義
this["b"+item].textBar.itemName._visible = false;//設(shè)置標(biāo)題不可見
}
mclListener.onLoadInit = function() {//設(shè)置偵聽方法為載入完成
if (item<flvTotal) {//當(dāng)計數(shù)器小于動畫總數(shù)
item++;//當(dāng)前一個動畫載入完成,計數(shù)器加一,
attachFlv();//繼續(xù)加載
}
};
var fnf = new TextFormat();//定義fnf的屬性
fnf.align = "center";//居中
fnf.size = "9";//9px號字
fnf.color = 0xffffff;//白色
var xArray = new Array();//聲明數(shù)組,用來存放每個小屏幕的未知的
var yArray = new Array();
var flvTotal;
_global.myXml = new XML();//聲明全局變量:開始準(zhǔn)備與xml文件通訊咯
myXml.ignoreWhite = true;
myXml.load("http://vod.cntvs.com/video/videowall/list1.xml");//要讀哪個文件呢?
_global.myArray = new Array();//存放動畫名稱的數(shù)組
_global.nameArray = new Array();//存放動畫標(biāo)題的數(shù)組
_global.linkArray = new Array();//存放鏈接地址的數(shù)組
myXml.onLoad = function() {//加載xml的方法
var e = myXml.firstChild.childNodes;//把xml里的內(nèi)容賦值給e
flvTotal = e.length;//一共幾條內(nèi)容呢?賦值給flvTotal吧
for (var i = 0; i<flvTotal; i++) {
myArray.push(e[i].attributes["title"]);//把xml文件里的title標(biāo)簽內(nèi)容放到myArray數(shù)組里
nameArray.push(e[i].attributes["name"]);//把xml文件里的name標(biāo)簽內(nèi)容放到nameArray數(shù)組里
linkArray.push(e[i].attributes["link"]);//把xml文件里的link標(biāo)簽內(nèi)容放到linkArray數(shù)組里
}
attachFlv();//開始加載第一個動畫,因為這里只執(zhí)行一次
};
/////////////////////////////////////////////////////////////////////////////////
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);//把每個小屏幕的未知告訴數(shù)組,記錄起來
yArray.push(butt._y);
butt.n = i;//給小屏幕編個號,以后好找.
butt.onRollOver = over;//當(dāng)小屏幕被鼠標(biāo)經(jīng)過就執(zhí)行function over
butt.onRollOut = out;//類似上面
butt.onRelease = rele;//還是類似上面
}
function over() {//當(dāng)鼠標(biāo)經(jīng)過小屏幕時執(zhí)行的方法
_root.pressnumber = this.n;//到底鼠標(biāo)指到哪個小屏幕呢?前面編的號碼就派用場了.
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;//內(nèi)容也要放大
_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() {//當(dāng)鼠標(biāo)離開小屏幕時執(zhí)行的方法
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() {//當(dāng)鼠標(biāo)點擊小屏幕時執(zhí)行的方法
_root.pressnumber = this.n;
getURL(linkArray[pressnumber-1], "_blank");
}
XML列表文件
復(fù)制代碼 代碼如下:
<?xml version="1.0" encoding="utf-8"?>
<flvLists>
<item title="http://vod.cntvs.com/video/videowall/item/bahentie-second.swf" name="藍(lán)頓疤痕貼" 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="靚立婷內(nèi)衣" 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="清風(fēng)車影" link="http://www.cntvs.com/Product_detail.asp?ID=15"/>
<item title="http://vod.cntvs.com/video/videowall/item/quban-second.swf" name="藍(lán)頓" link="http://www.cntvs.com/Product_detail.asp?ID=20"/>
<item title="http://vod.cntvs.com/video/videowall/item/null.swf" name="多密發(fā)" 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="藍(lán)頓祛痘組合" link="http://www.cntvs.com/Product_detail.asp?ID=21"/>
<item title="http://vod.cntvs.com/video/videowall/item/xueyitong-second.swf" name="學(xué)易通電子教師" link="http://www.cntvs.com/Product_detail.asp?ID=11"/>
<item title="http://vod.cntvs.com/video/videowall/item/renshenwen-second.swf" name=" 藍(lán)頓妊娠紋修護(hù)" 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="纖麗婷矯形內(nèi)衣" link="http://www.cntvs.com/Product_detail.asp?ID=42"/>
<item title="http://vod.cntvs.com/video/videowall/item/xuexizhen-second.swf" name="好學(xué)生學(xué)習(xí)枕" 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="聯(lián)邦悠悠挺" link="http://www.cntvs.com/Product_detail.asp?ID=46"/>
<item title="http://vod.cntvs.com/video/videowall/item/yilaida-second.swf" name="伊萊達(dá)玫瑰唇筆" 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="藍(lán)頓祛皺組合" 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>
打包文件下載
相關(guān)文章
利用asp或jsp,flash怎樣把數(shù)據(jù)庫中的一張表中的所有記錄讀取并顯示出來
利用asp或jsp,flash怎樣把數(shù)據(jù)庫中的一張表中的所有記錄讀取并顯示出來...2006-11-11比較完整簡潔的Flash處理XML文檔數(shù)據(jù)教程 上篇
比較完整簡潔的Flash處理XML文檔數(shù)據(jù)教程 上篇...2007-12-12關(guān)于FLASH與XML交互應(yīng)用中的理解
關(guān)于XML在FLASH中的應(yīng)用,以前寫過幾篇。也收集了幾篇來自網(wǎng)絡(luò)的。不過,都是一些非常簡單而常用的。在這里,我把XML的其他相關(guān)說明總結(jié)一下。有不足之處,希望大家能相互補充。只為了一個共同的目的:共同提高。2008-04-04使用 AllowNetworking Flash的世界安靜了
使用 AllowNetworking Flash的世界安靜了...2007-03-03