打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
一个flash播放器,就是不知道如何播完第一个,自动跳转下一个视频
一个flash播放器,就是不知道如何播完第一个,自动跳转下一个视频 [复制链接]
 
stop();
System.useCodepage = true;

//useage:
//you can modify the fellow code:
var easing = true;//true or false mean easing or not.
var auto = false;//true or false mean autoscroll or not
var mouseWheel = true;//true or fale mean support mousewheel or not.
var mouseCoord = true;//true or false mean use mouse coordinates or not.
var barVisual = true;//when useing mouse Coordinates you can set scroll bar hid or not. false mean hid.Note:If you
//didn't use mouse coordinates and set barVisual = false.you will only use mouseWheel scroll
//content.
var space = 5;//between list item space .
var path = "list1.xml";//xml path
contentMain.createEmptyMovieClip("back_mc", this.getNextHighestDepth());
contentMain.setMask(maskedView);
var myxml = new XML();
myxml.ignoreWhite = true;
myxml.onLoad = function(success) {
        var item = this.firstChild.childNodes;
        trace(this.firstChild.firstChild.attributes.videotitle);
        if (success) {
                for (var i:Number = 0; i<item.length; i++) {
                       
                        var temp_mc = contentMain.attachMovie("item", "item"+i, i);
                        temp_mc._y += i*(temp_mc._height+space);
                        contentMain.back_mc._height = i*(temp_mc._height+space);
                        temp_mc.tname = item[i].attributes.name;
                        temp_mc.tlink = item[i].attributes.link;
                        temp_mc.videotitle =item[i].attributes.videotitle;
                        temp_mc.thumb = item[i].firstChild.firstChild.nodeValue;
                       
                        temp_mc.item_txt.text = temp_mc.tname;
                        temp_mc.item_thumb.loadMovie(temp_mc.thumb);
                        contentHolder_mc.contentinfo.htmlText = item[0].childNodes[1].firstChild.nodeValue;
                        temp_mc.onRelease = function() {
                                vtitle_txt.text = this.videotitle;
                                playBut.onRelease();
                                videoDisplay.setMedia(this.tlink,"FLV");
                               
                        };
                }
                //first video and title
                vtitle_txt.text = this.firstChild.firstChild.attributes.videotitle;
                videoDisplay.setMedia(this.firstChild.firstChild.attributes.link,"FLV");
                scrolling(easing, auto, mouseWheel, mouseCoord, barVisual);
        } else {
                trace("error");
        }
};
myxml.load(path);

function scrolling(easing, auto, mouse) {
        //you can modify scroll speed.
        var moveSpeed = 1;
        //you can modify easing speed.
        var easingSpeed = 20;
        var scrollHeight = scrollbg._height;
        //you donnot need modify the fellowing code.if you are a AS coder you can do .
        var scrollable = contentMain._height-maskedView._height+2;
        var top_scroll = contentMain._y;
        var left = scrollbg._x-2;
        var top = scrollbg._y;
        var right = scrollbg._x-2;
        var bottom = scrollbg._y+scrollbg._height-dragger._height;
        if (scrollable<0) {
                dragger._visible = false;
                btnup._alpha = 0;
                btndown._alpha = 0;
                scrollbg._alpha = 0;
                btnup.enabled = false;
                btndown.enabled = false;
                return;
        }
        //update scroll content.              
        function updateContentPos() {
                var percent_scrolled = (dragger._y-btnup._y-btnup._height)/(scrollHeight-dragger._height);
                contentMain.newY = Math.round(top_scroll-(scrollable*percent_scrolled));
                trace(contentMain.newY);
        }
        contentMain.onEnterFrame = function() {
                if (!easing || easing == undefined) {
                        this._y = this.newY;
                } else {
                        this._y += (this.newY-this._y)/easingSpeed;
                }
        };
        //dragger function
        dragger.onPress = function() {
                startDrag(this, false, left, top, right, bottom);
                this.onMouseMove = function() {
                        updateContentPos();
                };
        };
        dragger.onRelease = dragger.onReleaseOutside=function () {
                stopDrag();
                delete this.onEnterFrame;
        };
        btnup.onPress = function() {
                this.onEnterFrame = function() {
                        dragger._y = Math.max(top, dragger._y-moveSpeed);
                        updateContentPos();
                };
        };
        btnup.onRelease = function() {
                delete this.onEnterFrame;
        };
        btndown.onPress = function() {
                this.onEnterFrame = function() {
                        dragger._y = Math.min(bottom, dragger._y+moveSpeed);
                        updateContentPos();
                };
        };
        btndown.onRelease = function() {
                delete this.onEnterFrame;
        };
        updateContentPos();
        //++++++++++++++++++++++++++++++++++++++++++
        //AutoScroll code
        if (auto == true) {
                onEnterFrame = function () {
                        if (dragger._y<bottom) {
                                dragger._y = dragger._y+0.3;
                                updateContentPos();
                        } else {
                                dragger._y = top;
                        }
                };
        }
        //+++++++++++++++++++++++++++++++++++++++++++            
        //mouseWheel code
        if (mouseWheel == true) {
                var mouseListener = new Object();
                mouseListener.onMouseWheel = function(delta) {
                        if (dragger._y<bottom) {
                                dragger._y += delta+3;
                                updateContentPos();
                        } else {
                                dragger._y = bottom-3;
                        }
                        if (dragger._y>top) {
                                dragger._y += delta;
                                updateContentPos();
                        } else {
                                dragger._y = top;
                        }
                };
                Mouse.addListener(mouseListener);
        }
        //++++++++++++++++++++++++++++++++++++++++++++         
        //Mouse coordinate
        if (mouseCoord == true) {
                maskedView.onEnterFrame = function() {
                        //trace(this.hitTest(_xmouse, _ymouse, false));
                        if (this.hitTest(_xmouse, _ymouse, false)) {
                                dragger._y = _ymouse;
                                updateContentPos();
                                if (dragger._y>bottom) {
                                        dragger._y = bottom;
                                        updateContentPos();
                                }
                        }
                };
        }
        //+++++++++++++++++++++++++++++++++++++++++++  
        //scroll bar hid setup
        if (barVisual == false) {
                dragger._visible = false;
                btnup._alpha = 0;
                btndown._alpha = 0;
                scrollbg._alpha = 0;
                btnup.enabled = false;
                btndown.enabled = false;
        }
        //+++++++++++++++++++++++++++++++++++++++++++  
}
 
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
制作FLV播放器源码教程_Flash AS教程
V1.5函数.html
闪客帝国:学堂:教程:饼状统计图
数组冒泡排序
增加Ajax相关的js方法
struct加Ajax
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服