爱你不要你 2010-3-8 16:58
Flash AS3.0实例:鼠标感应发光的文字效果
这是一个非常简单的教程,将学习用发光滤镜使对象产生发光的效果。注意:这个实例需要 TweenMax 类,请把附件中的gs类库保存在fla同一目录下。
AS3.0发光的文字效果实例
这是一个非常简单的教程,将学习用发光滤镜使对象产生发光的效果。
注意:这个实例需要 TweenMax 类,请把附件中的gs类库保存在fla同一目录下。
演示:
[swf]http://www.webjx.com/files/media/1_100307030156.swf[/swf]
1、新建Flash文件,设置属性:宽高根据舞台上的影片剪辑多少设定,我这里为[/swf]
[img]http://www.missyuan.net/uploads/allimg/100308/1A6064b7-0.png[/img]
2、选文本工具,在舞台上输入一些静态的本文。根据需要选择字型和字的大小。颜色选你喜欢的。图2:
[img]http://www.missyuan.net/uploads/allimg/100308/1A60623M-1.png[/img]
3、选菜单=>修改=>分离,把文字打散。图3:
[img]http://www.missyuan.net/uploads/allimg/100308/1A60C259-2.png[/img]
4、单选每一个字,右键单击转换为影片剪辑。命名根据你的需要,设定注册点为居中。图4:
[img]http://www.missyuan.net/uploads/allimg/100308/1A6063Q9-3.png[/img]
全部完成后库如图5:
[img]http://www.missyuan.net/uploads/allimg/100308/1A6061411-4.png[/img]
5、添加as层,选中第一帧,输入下列代码:
[quote]//Import tweenmax
import gs.*;
//Loop through all the letters in the stage
for (var i=0; i < numChildren; i++) {
//Get a letter (movie clip) from the stage
var mc:* = getChildAt(i);
//Add an MOUSE_OVER listener for the letter
mc.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
//Tween the letter to have a white glow
TweenMax.to(mc, 0.2 , {glowFilter:{color:0xffffff, alpha:1, blurX:10, blurY:10}});
}
//This function is called when the mouse is over an letter
function mouseOverHandler(e:Event):void {
//Save the letter to a local variable
var letter:MovieClip = e.target as MovieClip;
//Animate the letter.
//We call the function scaleBack() when the tween is finished
TweenMax.to(letter, 0.8 , {scaleX: -1, glowFilter:{color:0xff8800, blurX:20, blurY:20}, onComplete: scaleBack, onCompleteParams:[letter]});
}
//This function is called when a letter’s scaleX is -1
function scaleBack(letter:MovieClip):void {
//Animate the letter back to original state
TweenMax.to(letter, 0.2 , {scaleX: 1, glowFilter:{color:0xffffff, blurX:10, blurY:10}});
}[/quote]
6、完工,测试你的电影。
7、延伸:你可以把舞台上的影片剪辑更换为任何元素,任何颜色的光效果。
来源:中国教程网论坛 作者:cao4811
宁夏王子 2010-3-9 09:40
前几天做的。
[swf]http://images.missyuan.com/attachments/day_100309/20100309_967e2bc173d6ead72856jA8225KUu8a7.swf[/swf]
liu391635943 2010-3-27 22:54
很好看啊……学习了abc::04
xiaoxiaes 2010-3-31 11:08
挺好看的,附件在哪呢
tuzhate 2010-6-27 04:19
求解
1172: 找不到定义 gs。
这样的事什么意思啊?~abc::05
xiong10 2010-7-21 14:39
呵呵·俺也学过··只是是在读书的时候学了些简单的应用 至于那些命令·真的不晓得怎么弄··呵呵·· abc::55
tanhaichuan 2010-10-27 16:23
什么时候有空也要学下
袁小歪 2011-8-26 11:34
代码那些不知道在那里写,楼主写得太简单了。我投降了abc::05