求高手解释Flash代码

来源:百度知道 编辑:UC知道 时间:2024/09/25 18:18:23
//这是进度条的宽度:
w = 700;
Drag = false;
ball.onPress = function() {
if (_parent.Playing) {
Drag = true;
startDrag("ball", false,30,20 , w,35);
}
};
function onMouseUp() {
if (Drag) {

_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;
}
}

上面这段代码是我从网上找回来的,是用来控制Flash影片的进度条。我试用了,但不成功。依我理解 w为进度条的实例名称。ball是滑块的实例名称。

哪位高手能详细解释一下。

w应该是width的缩写,表示宽度的一个变量。别的你哪里看不懂最好具体说出来。

这个是控制声音的源代码
1.要先链接好声音!在场景第一帧加入如下代码:
Playing=true
mySound=new Sound()
mySound.attachSound("mySound")
2.建一个“ball”影片剪辑,然后在“ball”影片剪辑场景的第一帧加入如下代码:
//这是进度条的宽度:
w = 700;
Drag = false;
ball.onPress = function() {
if (_parent.Playing) {
Drag = true;
startDrag("ball", false,0,0 , w,0);
}
};
function onMouseUp() {
if (Drag) {

_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;
}
}