[flash]使用一个进度条控制视频播出

视频教程越来越多,怎么才能使读者自由地控制教程的进度呢,如下就有一个进度条的代码。 

 

onEnterFrame = function () {
        _root.jd_txt.text = "播放进度:"+_currentframe+"/"+_totalframes;
        _root.jd_mc.t_mc._x = int(_root._currentframe/_root._totalframes*(300-_root.jd_mc.t_mc._width));
};
_root.jd_mc.k_mc.onPress = function() {
        delete onEnterFrame;
        _root.jd_mc.t_mc._x = _root.jd_mc._xmouse;
};

_root.jd_mc.k_mc.onRelease = function() {
        gotoAndPlay(int(_root.jd_mc.t_mc._x/(300-_root.jd_mc.t_mc._width)*_root._totalframes));
        onEnterFrame = function () {
                jd_txt.text = "播放进度:"+_currentframe+"/"+_totalframes;
                _root.jd_mc.t_mc._x = int(_root._currentframe/_root._totalframes*(300-_root.jd_mc.t_mc._width));
        };
};

_root.jd_mc.t_mc.onPress = function() {
        delete onEnterFrame;
        startDrag(this, false, 0, -5, 300-this._width, -5);
        _root.jd_mc.t_mc.onEnterFrame = function() {
                gotoAndPlay(int(_root.jd_mc.t_mc._x/(300-_root.jd_mc.t_mc._width)*_root._totalframes));
                jd_txt.text = "播放进度:"+int(_root.jd_mc.t_mc._x/(300-_root.jd_mc.t_mc._width)*_root._totalframes)+"/"+_root._totalframes;
        };
};

_root.jd_mc.t_mc.onRelease = function() {
        stopDrag();
        delete _root.jd_mc.t_mc.onEnterFrame;
        gotoAndPlay(int(_root.jd_mc.t_mc._x/(300-_root.jd_mc.t_mc._width)*_root._totalframes));
        onEnterFrame = function () {
                jd_txt.text = "播放进度:"+_currentframe+"/"+_totalframes;
                _root.jd_mc.t_mc._x = int(_root._currentframe/_root._totalframes*(300-_root.jd_mc.t_mc._width));
        };
};

 

这里面有一个动态文本,两个影片剪辑,比较简单。

源程序见:http://www.oeasy.com.cn/viewthread.php?tid=1377&extra=page%3D1

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值