开发者

Applying Texture to the Movieclip

Here i am looking to apply the texture to the Text and Movie Cli开发者_Python百科p dynamically.is this possible to do?

Thanks in advance.


A simple way to do this is to embed the font, create a texture and set the text field as the mask for the texture bitmap:

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);
        }
    }
}

There was a pretty similar question on Stackoverflow. Check out other solutions here.


you can use beginBitmapFill()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜