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

mask

Get Adobe Flash player
by fumu 10 Apr 2009
    Embed
package {
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.events.MouseEvent;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..

            var tf:TextField = new TextField();
            tf.text = "●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●\n"
                        + "●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●\n"
                        + "●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●\n"
                        + "●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●\n"
                        + "●●●●●●●●●●●●●●●●●●●●●●●●○●●●●●●●●●●●\n"
                        + "●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●\n"
                        + "●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●\n"
                        + "●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●\n"
                        + "●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●\n"
                        + "●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●\n"
                        + "●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●\n"
                        + "●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●\n"
                        + "●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●\n"
                        + "●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●"
            tf.selectable = false;
            tf.wordWrap = false;
            tf.width = 500;
            tf.height = 500;
            addChild(tf);

            var square:Sprite = new Sprite();
            square.graphics.beginFill(0x999999);
            square.graphics.drawCircle(40, 40, 40);
//            square.graphics.drawRect(0, 0, 40, 40);
            addChild(square);

            tf.mask = square;

            tf.addEventListener(MouseEvent.MOUSE_DOWN, drag);
            tf.addEventListener(MouseEvent.MOUSE_UP, noDrag);

            function drag(event:MouseEvent):void {
                square.startDrag();
            }
            function noDrag(event:MouseEvent):void {
                square.stopDrag();
            }

        }
    }
}