虚位以待(AD)
虚位以待(AD)
首页 > 网页特效 > Flash > 做了一个flash视频墙[附源文件与xml文件]

做了一个flash视频墙[附源文件与xml文件]
类别:Flash   作者:码皇   来源:互联网   点击:

做了一个flash视频墙[附源文件与xml文件]

作者: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>

打包文件下载

相关热词搜索: 做了一个flash视频墙[附源文件]