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

Matrix Effect

Get Adobe Flash player
by Abarrow 19 Jul 2010
    Embed
// forked from Abarrow's forked from: forked from: forked from: wonderfl KeyVisual V.4.en
// forked from Abarrow's forked from: forked from: wonderfl KeyVisual V.4.en
// forked from Abarrow's forked from: wonderfl KeyVisual V.4.en

package {
    import flash.display.MovieClip;
    import flash.text.TextField;
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.geom.Transform;
    import flash.geom.ColorTransform;
    [SWF(backgroundColor="#000000", frameRate=20)]
    public class FlashTest extends MovieClip {
        public var ex:Number;
        public var ey:Number;
        public function FlashTest() {
            ex=0;
            ey=0;
            stage.addEventListener(MouseEvent.MOUSE_MOVE,mover);
        }
        private function mover(e:MouseEvent):void{
            if(Math.abs(ex-e.stageX)>10){
                ex=e.stageX;
                ey=e.stageY;
                matrixletter(ex,ey,true);
            }
            ex=e.stageX;
            ey=e.stageY;
        }
        private function matrixletter(x:Number,y:Number,auto:Boolean):void{
            var hold:MovieClip=new MovieClip();
            hold.x=Math.round(x/20)*20;
            hold.y=Math.round(y/20)*20;
            var tex:TextField=new TextField();
            tex.height=20;
            tex.selectable=false;
            hold.col=255;
            hold.tex=tex;
            hold.addChild(tex);
            hold.auto=auto;
            hold.transform.colorTransform=new ColorTransform(1,1,1,1,0,255,0,0);
            hold.addEventListener(Event.ENTER_FRAME,entering);
            addChild(hold);
        }
        private function entering(e:Event):void{
            if(e.target.auto) {
                matrixletter(e.target.x,e.target.y,false);
                e.target.y+=20;
                if(e.target.y>475){
                    e.target.removeEventListener(Event.ENTER_FRAME,entering);
                    e.target.parent.removeChild(e.target);
                }
            }else{
                e.target.col-=30;
                if(e.target.col<0){
                    e.target.removeEventListener(Event.ENTER_FRAME,entering);
                    e.target.parent.removeChild(e.target);
                }
                
                e.target.transform.colorTransform=new ColorTransform(1,1,1,1,0,e.target.col,0,0);
            }
            e.target.tex.text=char();
        }
        private function char():String{
            return String.fromCharCode(32+Math.round(Math.random()*95));
        }
    }
}