2011-09-03 94 views

回答

0

一個簡單的方法做,這是嵌入字體,創建一個紋理,並設置文本字段作爲面膜質地位:

package { 
    import flash.display.*; 
    import flash.text.*; 

    /** 
    * @author george 
    */ 
    public class MaskText extends Sprite { 
     FontClass_123ffed0d5f76880; 
     FontClass_123ffed0d5f76880_arial; 

     public function MaskText() { 
      init(); 
     } 
     private function init():void{ 
      //make text 
      var tf:TextField = new TextField(); 
      tf.defaultTextFormat = new TextFormat('arial',32); 
      tf.embedFonts = true; 
      tf.border = false; 
      tf.selectable = false; 
      tf.text = "TEXT"; 
      //make texture 
      var tex:BitmapData = new BitmapData(tf.textWidth, tf.textHeight,false,0); 
      tex.perlinNoise(110, 110, 32, 64, true, true, 7); 
      //create bitmap and apply mask 
      var b:Bitmap = new Bitmap(tex); 
      b.mask = tf; 
      addChild(b); 
      addChild(tf); 
     } 
    } 
} 

有一個關於Stackoverflow的非常類似的問題。查看其他解決方案here