as3.0 TweenLite TextField颜色渐变

package src
{
    import com.bit101.components.Label;
    import com.bit101.components.Style;
    import flash.text.TextField;
    import flash.text.TextFormat;
    
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    
    import com.greensock.TweenLite;
    import com.greensock.plugins.TintPlugin;
    import com.greensock.plugins.TweenPlugin;
    import com.greensock.plugins.GlowFilterPlugin;
    import com.greensock.plugins.ColorMatrixFilterPlugin;
    
    public class TweenLitePlugins extends MovieClip
    {
        public var _text:TextField;
        private  _image:MovieClip;
       
        public function TweenLitePlugins()
        {
            _image = new Ladeng();
            _image.x = stage.stageWidth / 2 - _image.width / 2;
            _image.y = 200;
            addChild(_image);
           
            stage.addEventListener(MouseEvent.MOUSE_DOWN,onStageMouseDown);
            createText();
            activatePlugins();
            setUI();
        }
       
        private function createText():void
        {
            var tf:TextFormat = new TextFormat("Impact",40,0);
            _text =  TextField();
            _text.text = "TintEffect with TweenLite";
            _text.setTextFormat(tf);
            _text.width = _text.textWidth+10;
            _text.x = stage.stageWidth / 2 - _text.width / 2;
            _text.y = stage.stageHeight / 2 - _text.height / 2;
            addChild(_text);
        }
       
        private function activatePlugins():
        {
            TweenPlugin.activate([TintPlugin,GlowFilterPlugin,ColorMatrixFilterPlugin]);
        }
        private function setUI():
        {
            Style.embedFonts = false;
            Style.fontSize = 12;
           
            var label:Label = new Label(this,10,30,"点击舞台,TweenLite会将文本内容缓动至一个随机的颜色。n同时将图像缓动至相同的随机颜色。");
            label.setSize(450,300);
        }
       
        private function onStageMouseDown(me:MouseEvent):var color:Number = Math.random() * 256 * 256 * 256;
            TweenLite.to(_text,1,{ tint:color,glowFilter: { color:0xff0000,alpha:1,blurX:50,blurY:60 }} );
            TweenLite.to(_image,{ colorMatrixFilter: { colorize:color,amout:1 }});
        }
       
    }

}

使用TweenPlugin的静态activate方法激活相应的插件

下面是TweenLite为我们提供的插件列表:

相关文章

  译序:JWMediaPlayer是开源的网页使用的Flash播放器。本...
    Flash编程原理都是只能将1写为0,而不能将0写成1.所...
 上传setenvgatewayip192.168.1.1;setenvserverip192.168.1...
Error:FlashDownloadFailed-"Cortex-M3"出现一般有...
jPlayer是一个用于控制和播放mp3文件的jQuery插件。它在后台...
#ifndef__FONTUPD_H__#define__FONTUPD_H__#include"sy...