播放器拖动进度条制作
类别: Flash教程
效果如下:
草草做了个,有些小问题,不过基本上实现楼主的想法,嗯...这些天老是觉得时间不够用,又要上课又要玩游戏...这是进度条的代码:
//这是进度条的宽度:
w = 100;
Drag = false;
ball.onPress = function() {
if (_parent.Playing) {
Drag = true;
startDrag(this, false, 0, 0, w, 0);
}
};
function onMouseUp() {
if (Drag) {
//不知有没有像gotoAndPlay()的函数,就不用那么麻烦了:
_parent.mySound.stop();
_parent.mySound.start(ball._x/w*_parent.mySound.duration/1000, 1);
//----------------------------------------------------------
Drag = false;
stopDrag();
}
}
function onEnterFrame() {
if (_parent.Playing && Drag == false) {
ball._x = _parent.mySound.position/_parent.mySound.duration*w;
}
}
w = 100;
Drag = false;
ball.onPress = function() {
if (_parent.Playing) {
Drag = true;
startDrag(this, false, 0, 0, w, 0);
}
};
function onMouseUp() {
if (Drag) {
//不知有没有像gotoAndPlay()的函数,就不用那么麻烦了:
_parent.mySound.stop();
_parent.mySound.start(ball._x/w*_parent.mySound.duration/1000, 1);
//----------------------------------------------------------
Drag = false;
stopDrag();
}
}
function onEnterFrame() {
if (_parent.Playing && Drag == false) {
ball._x = _parent.mySound.position/_parent.mySound.duration*w;
}
}
-= 资 源 教 程 =-
文 章 搜 索