对于一些特别炫的特效,一般的做法就是使用粒子软件构建效果,然后导入到FLASH中。而我们在FLASH中,也可以直接使用AS打造一些特效光炫。演示:http://www.taoshaw.com/taoshaw/study/jiguangxiaoguo/xiao.swf
制作过程比较复杂,在此不再详细介绍,把主要代码说一下,随后附源文件。
AS层中代码:
//禁止缩放
fscommand("allowscale", "false");
//建立没有右键的菜单 中国理财资讯门户网站
var my_cm:ContextMenu = new ContextMenu();
my_cm.hideBuiltInItems();
this.menu = my_cm;Controller实例下的代码:
//================版权声明开始================//
//★淘沙网:http://www.taoshaw.com
//★淘沙网所有教程欢迎转载。不过请转载时注明出处。谢谢合作。
//================版权声明结束================//
onClipEvent (load) {
Circles = new Array();
Colors = new Array();
//随机显示的颜色值
Hues = new Array(12255343, 16750848, 16763904, 10080767, 13762457, 8978392, 9795583, 16737938);
//循环显示的数量
maxLoops = 15;
numLoops = 8;
t = 0;
for (i=0; i<maxLoops; i++) {
Colors = new Color("_parent.bar"+i);
Colors.setRGB(Hues);
//设置扩充大小
setProperty("_parent.bar"+i, _yscale, 0);
}
//复制球体
for (i=0; i<numLoops; i++) {
attachMovie("circle", "C"+i, i);
Colors = new Color("C"+i);
Colors.setRGB(Hues);
Circles = new Object();
Circles.radius = 250-i*15;
Circles.orbit = i*30+15;
Circles.r2 = Circles.radius*Circles.radius*10;
Circles.f1 = Math.random()*40+40;
Circles.f2 = Math.random()*40+40;
Circles.f3 = Math.random()*40+40;
Circles.f4 = Math.random()*40+40;
Circles.p1 = Math.random()*6.280000E+000;
Circles.p2 = Math.random()*6.280000E+000;
Circles.p3 = Math.random()*6.280000E+000;
Circles.p4 = Math.random()*6.280000E+000;
setProperty("C"+i, _xscale, Circles.radius);
setProperty("C"+i, _yscale, Circles.radius);
}
for (i=0; i<numLoops; i++) {
Sounds.start(0, 999);
Sounds.setVolume(0);
}
}
onClipEvent (enterFrame) {
for (i=0; i<numLoops; i++) {
Circles.x = Math.sin(t/Circles.f1+Circles.p1)*Math.sin(t/Circles.f2+Circles.p2)*Circles.orbit*1.200000E+000;
Circles.y = Math.sin(t/Circles.f3+Circles.p3)*Math.sin(t/Circles.f4+Circles.p4)*Circles.orbit;
setProperty("C"+i, _x, Circles.x);
setProperty("C"+i, _y, Circles.y);
dx = _xmouse-Circles.x;
dy = _ymouse-Circles.y;
d = dx*dx;
d = d+dy*dy;
mix = Circles.r2/d;
if (mix>70) {
mix = 70;
}
Sounds.setVolume(mix);
setProperty("_parent.bar"+i, _yscale, mix);
}
++t;
}