In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

flash on 2009-9-9

Get Adobe Flash player
by pasodania 09 Sep 2009
    Embed
/**
 * Copyright pasodania ( http://wonderfl.net/user/pasodania )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/bkkl
 */

package {
    import flash.display.*;
    import flash.events.Event;
    import flash.text.*;
    
    [SWF(backgroundColor="#FFFFFF", width="450", height="80")]
    public class EasyDynamicTextMask extends Sprite {
        public function EasyDynamicTextMask() {
            // write as3 code here..
            stage.scaleMode = "noScale";
            
            // Show original Text(input)
            var text:TextField = new TextField();
            text.type = "input";
            text.autoSize = "left";
            text.htmlText = <font size="50" color="#000000">HELLO WORLD</font>.toXMLString();
            addChild(text);
            
            // Create Spirte
            var sprite:Sprite = new Sprite();
            addChild(sprite);
            
            // Set text as Mask
            sprite.mask = text;
            text.cacheAsBitmap = sprite.cacheAsBitmap = true;
            
            // Draw Sprite
            addEventListener("enterFrame", function(e:Event):void{
                sprite.graphics.beginFill(Math.random() * 0xFFFFFF);
                sprite.graphics.drawCircle(Math.random() * 450, Math.random() * 80, Math.random() * 50);
                sprite.graphics.endFill();
                
                if( Math.random() < .02){
                     sprite.graphics.clear();   
                }
            });
            
        }
    }
}