代码: |
import com.actionscript.text.TextScript; var myFormat:TextFormat = new TextFormat(); myFormat.font="Arial Black"; myFormat.bold = true; myFormat.size = 22; myFormat.color = 0x550000; var phrase:String = "Dynamic Effects with TextScript"; var xLoc:Number = 50; var yLoc:Number = 70; var delay:Number = 3; m = TextScript.blurIn(this, phrase, xLoc, yLoc, myFormat, delay); |
代码: |
onMouseUp = function() { TextScript.removeBlurIn(m, delay); } |
代码: |
TextScript.createEffect( scope:MovieClip, phrase:String, x:Number, y:Number, textFormat:TextFormat, delay: Number, customEffect:Function); |
代码: |
typeOn = function() { if(this.frameCount++ > this.delay) { this._visible = true; this.onEnterFrame = undefined; } } |
代码: |
import com.actionscript.text.TextScript; var tf:TextFormat = new TextFormat(); tf.font="Arial Black"; tf.bold = true; tf.size = 36; tf.color = 0x55FF55; typeOn = function() { if(this.frameCount++ > this.delay) { this._visible = true; this.onEnterFrame = undefined; } } var frameCounter:Number = 0; this.onEnterFrame = function() { if(frameCounter++ % 50 == 0) { m.removeMovieClip(); m = TextScript.createEffect(this, "Hello World!", 50, 10, tf, 2, typeOn); } } |
代码: |
rotateIn = function() { if(this.frameCount++ > this.delay) { this._rotation = -180; this._visible = true; this.onEnterFrame=function() { this._rotation += 10; if(this._rotation >= 0) { this._rotation = 0; this.onEnterFrame = undefined; } } } } |
代码: |
import com.actionscript.text.TextScript; var tf:TextFormat = new TextFormat(); tf.font="Arial Black"; tf.bold = true; tf.size = 36; tf.color = 0x55FF55; rotateIn = function() { if(this.frameCount++ > this.delay) { this._rotation = -180; this._visible = true; this.onEnterFrame=function() { this._rotation += 10; if(this._rotation >= 0) { this._rotation = 0; this.onEnterFrame = undefined; } } } } var frameCounter:Number = 0; this.onEnterFrame = function() { if(frameCounter++ % 70 == 0) { m.removeMovieClip(); m = TextScript.createEffect(this, "Hello World!", 50, 10, tf, 2, rotateIn); } } |
代码: |
TextScript.removeEffect(m:MovieClip, delay:Number, effect:Function); |
代码: |
fadeOut = function() { if(this.frameCount++ > this.delay) { this.onEnterFrame = function() { this._alpha -= 10; if(this._alpha <= 0) { this.remove(); } } } } |
代码: |
import com.actionscript.text.TextScript; var tf:TextFormat = new TextFormat(); tf.font="Arial Black"; tf.bold = true; tf.size = 36; tf.color = 0x55FF55; fadeOut = function() { if(this.frameCount++ > this.delay) { this.onEnterFrame = function() { this._alpha -= 10; if(this._alpha <= 0) { this.remove(); } } } } var frameCounter:Number = 0; this.onEnterFrame = function() { if(frameCounter++ % 65 == 0) { m.removeMovieClip(); m = TextScript.createEffect(this, "Hello World!", 50, 10, tf, 2, function(){}); //下面的代码是轮询出每一个字符元件,因为我们没有给出constructive方法(如上例中方法为function(){},前没有给出具体的constructive方法)我们需要让它们都可见,以便显示出来destructive方法。 for(var i in m) { m._visible = true; } TextScript.removeEffect(m, 2, fadeOut); } } |
附加演示文件:
深入:
当使用TextScript创建字体效果时,记住你使用的都是movieclip的强大功能。你可以改变字体的色彩,应用滤镜和融合效果,重建复杂的物理效果,并且不要忘记也可以使用声音或其它媒体。这个类编写的相对比较简单,但是它的伸缩性很强,加上你的一点点创意,你应能创建出更有趣的效果来。你可以在TextScript类中查看切换效果函数(从类的第108行开始).它们是内置的createEffect和removeEffect方法。如果你创建出的很酷的效果,不要忘记分享啦。J
egoldy提示:在做中文体效果时,我们同样需要嵌入字体,如上面范例制作时嵌入的“方正简美黑”,但大家可能会担心会变大,这是肯定的,如果制作很长的段落是不合适的,用于制做文字不是很多的内容还是很合适的,在上面的范例中如我使用的文本为” 欢迎来到webstudio”那么在嵌入字体时只需要将这一行字嵌入就可以了,这样每个文件并不会超过10k.同样也会满足我们的大多数需求。Cheers J..
全部源文件下载 |
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |