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 example

Get Adobe Flash player
by Good 22 Jul 2012
/**
 * Copyright Good ( http://wonderfl.net/user/Good )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/xefs
 */

package  {
    import flash.geom.Point;
    import flash.text.TextFormat;
    import flash.text.TextField;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.geom.Matrix;
    
    [SWF (width=465, height=465)]
    public class M extends Sprite {
        public function M () {
            
            x = 150;
            y = 465 / 2; 
            
            var tf:TextField = new TextField();
            tf.autoSize = 'left';
            tf.x = -100; tf.y = -200;
            addChild(tf);
            tf.defaultTextFormat = new TextFormat('arial', 11, 0x333333, true);
            
            var mx:Matrix = new Matrix(1, .5, -1, .5, 100, 0); 
                                     
            addEventListener (Event.ENTER_FRAME, function (e:Event):void {
                
                var a:Point = new Point( mouseX, mouseY );
                var b:Point = mx.transformPoint(a);  
                
                graphics.clear (); 
                
                graphics.lineStyle (2, 0xffcc33);
                graphics.drawRect(-100,-100,200,200);
                graphics.drawCircle(a.x,a.y,3);
                
                graphics.lineStyle(2, 0x33ccff);
                graphics.moveTo(-100,0);
                graphics.lineTo(100,-100);
                graphics.lineTo(300,0);
                graphics.lineTo(100,100);
                graphics.lineTo(-100,0);
                graphics.drawCircle(b.x,b.y,3);
                
                graphics.lineStyle(1, 0x777777);
                graphics.moveTo(a.x, a.y);
                graphics.lineTo(b.x, b.y);
                                
                tf.text = a + '\n' + b;
            });
        }

    }
}