活法第一章读后感200字:flash代码问题 高手请近来!!

来源:百度文库 编辑:高校问答 时间:2024/04/26 16:23:04
我做一个按纽 然后把他放到一个影片剪辑中 然后把这个影片剪辑拉到场景中,选该影片剪辑加入如下代码:onClipEvent (load)
{
function speed(num)
{
speedX = -(_root._xmouse - hx) / num;
return(speedX);
} // End of the function
function trans()
{
p = p + speed(60);
range = (p + 360) * 3.141593 / 180;
re1 = Math.sin(range) * r;
re2 = Math.cos(range) * a;
} // End of the function
function property()
{
trans();
_x = hx + re1;
_alpha = re2 + 70;
_yscale = re2 + 70;
_xscale = re2 + 70;
this.swapDepths(_alpha);
} // End of the function
hx = 495;
hy = 200;
r = 100;
a = 30;
}
onClipEvent (enterFrame)
{
property();
}
但是输出的这个影片不会动,不知道问题出现在哪里!!我是仿照着事例做的,不能得到要达到的效果,还请高手指点!!谢谢!!!!

把原代码删了,换成下面这个:
onClipEvent (load) {
function speed(num) {
speedX = -(_root._xmouse-hx)/num;
return (speedX);
}
// End of the function
function trans() {
p = p+speed(60);
range = (p+360)*3.141593/180;
re1 = Math.sin(range)*r;
re2 = Math.cos(range)*a;
}
// End of the function
function property() {
trans();
_x = hx+re1;
_alpha = re2+70;
_yscale = re2+70;
_xscale = re2+70;
this.swapDepths(_alpha);
}
// End of the function
hx = Stage.width/2;
hy = 200;
r = 100;
a = 30;
p = 0;
}
onClipEvent (enterFrame) {
property();
}
主要是少了一个P的定义,另外hx的值设置过大,如果主场景太小的话就看不到剪辑了,所以作了如上修改。