1、先插入一个影片剪辑,在影片剪辑内制作一段动画,时间可长一些。回到场景,图层1将动画从库中拖入到场景中,并设置实例名称为:yp_mc
2、插入-新建元件-影片剪辑,然后在里面画一个进度条,注意进度条的最左边要和影片剪辑的中心对齐,高度要在正中(x座标为0,y座标为矩形的正中位置)
3、回到场景,新建图层2,将进度条拖入场景中,摆好位置,并设置其实例名称为:blt_mc
4、新建影片剪辑,画一个小滑块,位置在正中。
5、回到场景,新建图层3,放入小滑块,位置要和进度条的最左边位置重合(滑块和进度条的x座标要相同),然后设置滑块的实例名称为:hk_mc
6、新建图层4,添加一个动态文本框进来,放在进度条的右边,用以显示动画播放进度的百分比。动态文本框设置实例名称为:num
7、新建图层5,在这一帧设置帧动作:l = blt_mc._x;r = l+blt_mc._width;h = blt_mc._y;hk_mc.onEnterFrame = function() {this._x = blt_mc._x+int((blt_mc._width/yp_mc._totalframes)*yp_mc._currentframe);pp.text = int((blt_mc._width/yp_mc._totalframes)*yp_mc._currentframe);kk = int((hk_mc._x-blt_mc._x)/blt_mc._width*100);num.text = kk+"%";};hk_mc.onPress = function() {startDrag(this, false, l, h, r, h);delete hk_mc.onEnterFrame;};hk_mc.onRelease=function () {stopDrag();kk = int((hk_mc._x-blt_mc._x)/blt_mc._width*100);num.text = kk+"%";rr = int(yp_mc._totalframes*kk/100);yp_mc.gotoAndPlay(rr);hk_mc.onEnterFrame = function() {this._x = blt_mc._x+int((blt_mc._width/yp_mc._totalframes)*yp_mc._currentframe);pp.text = int((blt_mc._width/yp_mc._totalframes)*yp_mc._currentframe);kk = int((hk_mc._x-blt_mc._x)/blt_mc._width*100);num.text = kk+"%";};};hk_mc.onReleaseOutside=function () {stopDrag();kk = int((hk_mc._x-blt_mc._x)/blt_mc._width*100);num.text = kk+"%";rr = int(yp_mc._totalframes*kk/100);yp_mc.gotoAndPlay(rr);hk_mc.onEnterFrame = function() {this._x = blt_mc._x+int((blt_mc._width/yp_mc._totalframes)*yp_mc._currentframe);pp.text = int((blt_mc._width/yp_mc._totalframes)*yp_mc._currentframe);kk = int((hk_mc._x-blt_mc._x)/blt_mc._width*100);num.text = kk+"%";};};