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 2012-5-21

Get Adobe Flash player
by jokehn9 21 May 2012
    Embed
/**
 * Copyright jokehn9 ( http://wonderfl.net/user/jokehn9 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/z5eG
 */

package {
    import flash.geom.Matrix;
    import flash.events.Event;
    import flash.display.BitmapData;
    import flash.display.Bitmap;
    import flash.display.Shape;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var i:Number = 0;
            var cS:Shape = new Shape();
            var r:Number = 50;
            var r2:Number = 80;
            cS.graphics.lineStyle(3,0x0);
            cS.graphics.beginFill(0xff0000);
            cS.graphics.moveTo(r * Math.cos(2.14)+ 0.2*r * Math.sin(2.14),r * Math.sin(2.14));
            for(i=0;i<5.75;i+=0.1) {
                cS.graphics.lineTo(r * Math.cos(i+2.14)+ 0.2*r * Math.sin(i+2.14), r *Math.sin(i+2.14));
            }
            cS.graphics.lineTo(r2*Math.cos(7.89)+ 0.2*r2 * Math.sin(7.89),r2*Math.sin(7.89));
            for(i=0;i>-5.75;i-=0.1) {
                cS.graphics.lineTo(r2* Math.cos(i + 7.89) + 0.2*r2 * Math.sin(i + 7.89),r2 * Math.sin(i + 7.89));
            }
            cS.graphics.lineTo(r*Math.cos(2.14) + 0.2*r2 * Math.sin(i + 2.14), r * Math.sin(2.14));

            cS.x = 226;
            cS.y = 226;
            addChild(cS);
            
            var bd:BitmapData = new BitmapData(465, 465, false, 0x983894);
            
            var m1:Matrix = new Matrix(1,10,0,1,256,256);
            var m2:Matrix = new Matrix(Math.cos(0.3),Math.sin(0.3),Math.cos(0.3),-Math.sin(0.3),256,256);
            var m3:Matrix = new Matrix();
            cS.transform.matrix = m1;
            bd.draw(cS,cS.transform.matrix);
            var bt:Bitmap = new Bitmap(bd);
            addChild(bt);
            addEventListener("enterFrame", fc);
            i = 0;
            var a:Number,b:Number,c:Number,d:Number;
         
            function fc(e:Event):void {
                bd.fillRect(bd.rect,0x983894);
                a = Math.cos(i);
                b = Math.sin(i);
                c = -Math.sin(i);
                m2 =new Matrix(a,b,c,a,256,256);
                m3 = new Matrix(m2.a*m1.a + m2.b*m1.c,m2.b *m1.a + m2.d* m1.b ,m2.a *m1.c + m2.c * m1.d, m2.b * m1.c + m2.d * m1.d,256,256); 
                cS.transform.matrix = m2;
                bd.draw(cS,cS.transform.matrix);
                i+= 0.1;
            }

        }
    }
}