当前位置:96看吧 > 实用代码 > 焦点图 > 迅雷高清频道flash+xml焦点图

迅雷高清频道flash+xml焦点图

时间:2010/04/20
作者:MaWendong.CN
来源:本站整理
查看:

as源代码1

package src {
    import flash.events.*;
    import flash.display.*;
    import flash.utils.*;
    import flash.text.*;
    import flash.geom.*;

    public class Big extends Sprite {

        const PW:int = 265;
        const SW:int = 960;
        const SH:int = 230;
        const WW:int = 815;

        var _buf_sw_x:Number;// = 0
        var _t_auto_scroll:Timer;
        var _curr_index:int;// = 2
        var _side:int;// = 1
        var _total:int;// = 0
        var _btn_left:BtnLeft;
        var _page:PageFooter;
        var _arr_poster:Array;
        var _motion_done:Boolean;// = true
        var _show_window:Sprite;
        var _mask:Shape;
        var _t_sw:Timer;
        var _btn_right:BtnRight;
        var _loading:Loading;

        public function Big(){
            _arr_poster = [];
            _curr_index = 2;
            _total = 0;
            _motion_done = true;
            _buf_sw_x = 0;
            _side = 1;
            super();
            new XmlLoader("/online/list/xml/dapian.xml", xml_cb);
            _loading = new Loading();
            addChild(_loading);
            _loading.x = ((SW - _loading.width) / 2);
            _loading.y = ((SH - _loading.height) / 2);
            graphics.beginBitmapFill(new StageBG(SW, SH));
            graphics.drawRect(0, 0, SW, SH);
            graphics.endFill();
        }
        function _btn_right_CLICK(_arg1=null){
            var _local2:*;
            if (!_motion_done){
                return;
            };
            _motion_done = false;
            _side = 1;
            if (_curr_index == (_total + 1)){
                _arr_poster[_total].hide();
                _arr_poster[(_total + 1)].hide();
                _arr_poster[(_total + 2)].hide();
                _curr_index = 1;
                _show_window.x = 50;
            };
            _t_sw.reset();
            _buf_sw_x = _show_window.x;
            if (_curr_index == 1){
                _arr_poster[0].alpha = 1;
                _arr_poster[1].alpha = 1;
                _arr_poster[2].alpha = 1;
                _arr_poster[0].init();
            };
            _t_sw.start();
            _local2 = _curr_index;
            _arr_poster[(_local2 - 1)].hide();
            _arr_poster[_local2].diminish();
            _arr_poster[(_local2 + 1)].largen();
            _arr_poster[(_local2 + 2)].show();
        }
        function _btn_left_CLICK(_arg1=null){
            var _local2:*;
            if (!_motion_done){
                return;
            };
            _motion_done = false;
            _side = -1;
            if (_curr_index == 1){
                _arr_poster[0].hide();
                _arr_poster[1].hide();
                _arr_poster[2].hide();
                _curr_index = (_total + 1);
                _show_window.x = -((1130 + ((_total - 4) * 295)));
                trace(_show_window.x);
            };
            _local2 = _curr_index;
            _t_sw.reset();
            _buf_sw_x = _show_window.x;
            if (_curr_index == (_total + 1)){
                _arr_poster[_total].alpha = 1;
                _arr_poster[(_total + 1)].alpha = 1;
                _arr_poster[(_total + 2)].alpha = 1;
                _arr_poster[(_total + 2)].init();
            };
            _t_sw.start();
            _arr_poster[(_local2 + 1)].hide();
            _arr_poster[_local2].diminish();
            _arr_poster[(_local2 - 1)].largen();
            _arr_poster[(_local2 - 2)].show();
        }
        function copyObj(_arg1){
            var _local2:*;
            var _local3:*;
            _local2 = {};
            for (_local3 in _arg1) {
                _local2[_local3] = _arg1[_local3];
            };
            return (_local2);
        }
        function auto_scroll(_arg1){
            _btn_right_CLICK();
        }
        function xml_cb(_arg1){
            var l:*;
            var arr:Array;
            var i:*;
            var o:*;
            var p:*;
            var xml = _arg1;
            _btn_left = new BtnLeft();
            _btn_right = new BtnRight();
            _btn_left.addEventListener("click", _btn_left_CLICK);
            _btn_right.addEventListener("click", _btn_right_CLICK);
            _btn_left.addEventListener("mouseOver", function (_arg1){
                _t_auto_scroll.stop();
            });
            _btn_right.addEventListener("mouseOver", function (_arg1){
                _t_auto_scroll.stop();
            });
            _btn_left.addEventListener("mouseOut", function (_arg1){
                _t_auto_scroll.start();
            });
            _btn_right.addEventListener("mouseOut", function (_arg1){
                _t_auto_scroll.start();
            });
            l = (_total = xml.Item.length());
            _page = new PageFooter(l);
            removeChild(_loading);
            _t_auto_scroll = new Timer(6000);
            _t_auto_scroll.addEventListener("timer", auto_scroll);
            arr = [];
            i = 0;
            o = null;
            while (i < l) {
                o = xml.Item[i];
                p = {pic_url:o.Pic, m_id:o.Movieid, m_name:o.Name, desc:o.Desc, link:o.Link, timer_auto:_t_auto_scroll};
                arr.push(p);
                i = (i + 1);
            };
            i = 0;
            while (i < l) {
                arr[i].page = i;
                i = (i + 1);
            };
            arr.unshift(copyObj(arr[(l - 1)]));
            arr.pop();
            arr.unshift(copyObj(arr[(l - 1)]));
            arr.push(copyObj(arr[1]));
            arr.push(copyObj(arr[2]));
            i = 0;
            l = arr.length;
            while (i < l) {
                arr[i].sn = i;
                i = (i + 1);
            };
            load_poster(arr);
            if (_total > 3){
                addChild(_btn_left);
                addChild(_btn_right);
            } else {
                _t_auto_scroll.stop();
            };
            addChild(_page);
            _btn_left.x = 30;
            _btn_left.y = 90;
            _btn_right.x = 906;
            _btn_right.y = 90;
            _page.x = 906;
            _page.y = 200;
        }
        function _t_sw_Complete(_arg1){
            _motion_done = true;
            _curr_index = (_curr_index + _side);
            _page.current = _arr_poster[_curr_index].page;
        }
        function cpu(_arg1, _arg2, _arg3, _arg4){
            _arg1 = ((_arg1 / _arg4) - 1);
            return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
        }
        function load_poster(_arg1){
            var _local2:*;
            _show_window = new Sprite();
            _local2 = 0;
            while (_local2 < _arg1.length) {
                _arr_poster.push(new Poster(_arg1[_local2]));
                _show_window.addChild(_arr_poster[_local2]);
                _arr_poster[_local2].x = ((PW + 30) * _local2);
                _arr_poster[_local2].y = 30;
                _local2++;
            };
            addChild(_show_window);
            _show_window.x = (20 - PW);
            _t_sw = new Timer(40, 10);
            _t_sw.addEventListener("timer", _t_sw_Handler);
            _t_sw.addEventListener("timerComplete", _t_sw_Complete);
        }
        function _t_sw_Handler(_arg1){
            _show_window.x = (_buf_sw_x + cpu(_t_sw.currentCount, 0, (-(_side) * 295), _t_sw.repeatCount));
        }

    }
}//package src

as源代码2

package src {
    import flash.events.*;
    import flash.net.*;
    import flash.display.*;
    import flash.utils.*;
    import flash.text.*;
    import flash.geom.*;
    import flash.filters.*;
    import flash.external.*;
    import flash.system.*;

    public class Poster extends Sprite {

        const PW:int = 265;
        const SCALE:Number = 0.75;
        const PHA:int = 206;
        const PHS:int = 186;
        const PHP:int = 159;

        var _suit:Sprite;
        var _t_lager:Timer;
        var _t_show:Timer;
        var _loaded:Boolean;// = false
        var _t_hide:Timer;
        var _txt_desc:TextField;
        var _txt_name:TextField;
        var _t_glow:Timer;
        var _t_smaller:Timer;
        var _t_glow_off:Timer;
        var _bmp:BitmapData;
        var _pic:Sprite;
        var _t_autoscroll:Timer;
        var _p:Object;
        var _loading:Loading;

        public function Poster(_arg1){
            var _local2:*;
            _loaded = false;
            super();
            _p = _arg1;
            buttonMode = true;
            _local2 = new Loader();
            _local2.load(new URLRequest(_arg1.pic_url), new LoaderContext(true));
            _local2.contentLoaderInfo.addEventListener(Event.COMPLETE, picOnload);
            building(_arg1);
            _t_autoscroll = _arg1.timer_auto;
        }
        public function init(){
            calc_pos(SCALE);
        }
        function transformer(_arg1, _arg2=0){
            var _local3:*;
            var _local4:*;
            switch (_arg2){
                case 0:
                    calc_pos(_arg1);
                    break;
                case 1:
                    _local3 = width;
                    _local4 = height;
                    scaleX = _arg1;
                    scaleY = _arg1;
                    x = (x - ((width - _local3) / 2));
                    y = (y - ((height - _local4) / 2));
                    alpha = (_arg1 / 3);
                    break;
                case 2:
                    calc_pos(_arg1);
                    alpha = (_arg1 + 0.3);
                    break;
            };
        }
        function picClick(_arg1){
            ExternalInterface.call("window.open", _p.url, _p.target);
        }
        public function show(){
            _t_show.reset();
            _t_show.start();
        }
        function calc_pos(_arg1){
            _suit.width = (PW * _arg1);
            _suit.height = (PHS * _arg1);
            _suit.x = (((PW + 2) - _suit.width) / 2);
            _suit.y = (((PHP + 2) - _suit.height) / 2);
            _txt_name.y = (((_pic.height * _arg1) + 10) + _suit.y);
            _txt_desc.y = (_txt_name.y + 19);
        }
        function picOnload(_arg1){
            _suit.removeChild(_loading);
            _bmp = _arg1.target.content.bitmapData;
            _pic.alpha = 0;
            _pic.graphics.beginBitmapFill(_bmp, null, false);
            _pic.graphics.moveTo(1, 1);
            _pic.graphics.drawRect(1, 1, PW, PHP);
            _pic.graphics.endFill();
            fadeIn();
            _suit.addChild(create_ref(_pic));
            _loaded = true;
            if (_p.sn == 0){
                _t_autoscroll.start();
            };
        }
        public function hide(){
            _t_hide.reset();
            _t_hide.start();
        }
        public function largen(){
            _t_lager.reset();
            _t_lager.start();
        }
        public function get bmp(){
            return (_bmp);
        }
        public function get page(){
            return (_p.page);
        }
        function cpu(_arg1, _arg2, _arg3, _arg4){
            _arg1 = ((_arg1 / _arg4) - 1);
            return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
        }
        public function glow(){
            _t_glow_off.reset();
            _t_glow_off.stop();
            _t_glow.start();
        }
        function add_gesture(){
            var picOver:Function;
            var picOut:Function;
            var tlH:Function;
            var tsmH:Function;
            var thH:Function;
            var thCH:Function;
            var tshH:Function;
            var tgH:Function;
            var tgoH:Function;
            picOver = function (_arg1){
                if (!_loaded){
                    return;
                };
                glow();
                _t_autoscroll.stop();
            };
            picOut = function (_arg1){
                if (!_loaded){
                    return;
                };
                glow_off();
                _t_autoscroll.start();
            };
            tlH = function (_arg1){
                transformer(cpu(_t_lager.currentCount, SCALE, (1 - SCALE), _t_lager.repeatCount));
            };
            tsmH = function (_arg1){
                transformer(cpu(_t_smaller.currentCount, 1, (SCALE - 1), _t_smaller.repeatCount));
            };
            thH = function (_arg1){
                transformer(cpu(_t_hide.currentCount, SCALE, (-(SCALE) + 0.2), _t_hide.repeatCount), 1);
            };
            thCH = function (_arg1){
                transformer(1, 1);
                alpha = 0;
            };
            tshH = function (_arg1){
                transformer(cpu(_t_show.currentCount, 0.2, (SCALE - 0.2), _t_show.repeatCount), 2);
            };
            tgH = function (_arg1){
                var _local2:*;
                _local2 = cpu(_t_glow.currentCount, 0, 1, _t_glow.repeatCount);
                _pic.filters = [new GlowFilter(3394815, _local2, 15, 15, 1.5, BitmapFilterQuality.HIGH)];
            };
            tgoH = function (_arg1){
                var _local2:*;
                _local2 = cpu(_t_glow_off.currentCount, 1, -1, _t_glow_off.repeatCount);
                _pic.filters = [new GlowFilter(3394815, _local2, 15, 15, 1.5, BitmapFilterQuality.HIGH)];
            };
            _pic.addEventListener("mouseOver", picOver);
            _pic.addEventListener("mouseOut", picOut);
            _pic.addEventListener("click", picClick);
            _suit.addEventListener("mouseOut", picOut);
            _t_lager = new Timer(40, 10);
            _t_smaller = new Timer(40, 10);
            _t_hide = new Timer(40, 10);
            _t_show = new Timer(40, 10);
            _t_lager.addEventListener("timer", tlH);
            _t_smaller.addEventListener("timer", tsmH);
            _t_hide.addEventListener("timer", thH);
            _t_hide.addEventListener("timerComplete", thCH);
            _t_show.addEventListener("timer", tshH);
            _t_glow = new Timer(40, 10);
            _t_glow_off = new Timer(40, 6);
            _t_glow.addEventListener("timer", tgH);
            _t_glow_off.addEventListener("timer", tgoH);
        }
        function building(_arg1){
            if (_p.m_id == 0){
                _p.target = "_blank";
                _p.url = _p.link;
            } else {
                _p.target = "kankanWindow";
                _p.url = (((("http://kankan.xunlei.com/4.0/movie/" + (_p.m_id % 100)) + "/") + _p.m_id) + ".html");
            };
            _txt_name = new TextField();
            _txt_name.width = PW;
            _txt_name.height = 12;
            _txt_name.autoSize = TextFieldAutoSize.CENTER;
            _txt_name.defaultTextFormat = new TextFormat("宋体", 12, 15527147, true);
            _txt_name.htmlText = (((((("<a href=\"" + _p.url) + "\" target=\"") + _p.target) + "\">") + _arg1.m_name) + "</a>");
            _txt_desc = new TextField();
            _txt_desc.width = PW;
            _txt_desc.height = 12;
            _txt_desc.autoSize = TextFieldAutoSize.CENTER;
            _txt_desc.defaultTextFormat = new TextFormat("宋体", 12, 0x666666);
            _txt_desc.htmlText = (((((("<a href=\"" + _p.url) + "\" target=\"") + _p.target) + "\">") + _arg1.desc) + "</a>");
            _pic = new Sprite();
            _suit = new Sprite();
            _pic.graphics.beginFill(2238250);
            _pic.graphics.drawRect(0, 0, (PW + 2), (PHP + 2));
            _pic.graphics.endFill();
            _pic.alpha = 0.5;
            _suit.addChild(_pic);
            _suit.addChild(create_ref(_pic));
            _loading = new Loading();
            _loading.x = ((_suit.width - _loading.width) / 2);
            _loading.y = ((_suit.height - _loading.height) / 2);
            _suit.addChild(_loading);
            addChild(_suit);
            addChild(_txt_name);
            addChild(_txt_desc);
            add_gesture();
            if ((((_p.sn == 1)) || ((_p.sn == 3)))){
                diminish();
            } else {
                if (_p.sn == 2){
                    transformer(1);
                } else {
                    alpha = 0;
                    calc_pos(0.2);
                };
            };
        }
        function fadeIn(){
            var t:Timer;
            t = new Timer(40, 5);
            t.addEventListener("timer", function (_arg1){
                _pic.alpha = cpu(t.currentCount, 0, 1, t.repeatCount);
            });
            t.start();
        }
        public function diminish(){
            _t_smaller.reset();
            _t_smaller.start();
        }
        public function glow_off(){
            _t_glow.reset();
            _t_glow.stop();
            _t_glow_off.start();
        }
        function create_ref(_arg1){
            var _local2:BitmapData;
            var _local3:Matrix;
            var _local4:Number;
            var _local5:Number;
            var _local6:Sprite;
            var _local7:BitmapData;
            var _local8:Sprite;
            var _local9:*;
            var _local10:*;
            _local2 = new BitmapData(_arg1.width, _arg1.height, true, 0);
            _local3 = new Matrix();
            _local3.d = -1;
            _local3.ty = _local2.height;
            _local2.draw(_arg1, _local3);
            _local4 = _arg1.width;
            _local5 = Math.floor((_local2.height / 6));
            _local3 = new Matrix();
            _local3.createGradientBox(_local4, _local5, (Math.PI / 2), 0, 0);
            _local6 = new Sprite();
            _local6.graphics.beginGradientFill("linear", [0, 0], [0.5, 0], [0, 0xFF], _local3);
            _local6.graphics.lineTo(_local4, 0);
            _local6.graphics.lineTo(_local4, _local5);
            _local6.graphics.lineTo(0, _local5);
            _local6.graphics.endFill();
            _local6.visible = false;
            _local7 = new BitmapData(_local4, _local5, true, 0);
            _local7.draw(_local6);
            _local2.copyPixels(_local2, _local2.rect, new Point(0, 0), _local7, new Point(0, 0), false);
            _local8 = new Sprite();
            _local9 = _arg1.x;
            _local10 = ((_arg1.y + _arg1.height) - 1);
            _local8.graphics.beginBitmapFill(_local2);
            _local8.graphics.drawRect(_local9, _local10, _local4, _local5);
            _local8.alpha = 0.8;
            return (_local8);
        }

    }
}//package src

 

上一篇:百度视频频道flash焦点图
下一篇:漂亮flash焦点图
下载地址
Down
页面举报
Report
关闭页面
Close
收藏页面
Favorites
分享页面
Share
版权信息:栏目内,站内会员所分享的全部“资源/素材/文章”,仅供学习与参考,版权为原作者所有。
下载提示:非注册用户每天可下载一个文件,已注册会员不受限制。
网友评论
数据载入中
验证码
  • 请您注意:
  • ·请不要在评论中含与内容无关的广告链接。
  • ·不良评论请用报告管理员,以利管理员及时删除。
  • ·遵守中华人民共和国的各项有关法律法规
  • ·承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • ·本站管理人员有权保留或删除评论中的任意内容
  • ·您在本站发表的作品,本站有权在网站内转载或引用
  • ·参与本评论即表明您已经阅读并接受上述条款
相关最新
相关热门