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

forked from: ヴィトン

Get Adobe Flash player
by kevinstyle 25 Feb 2011
/**
 * Copyright kevinstyle ( http://wonderfl.net/user/kevinstyle )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/8hEX
 */

// forked from kawamura's ヴィトン
package  {
    import flash.display.MovieClip;
    import flash.events.Event;
    
    public class FlashTest extends MovieClip {
        
        private var scx:Number;
        private var scy:Number;
        private var back:MovieClip
        private var front:MovieClip
        public function FlashTest() {
            // constructor code
            var mesh:Mesh;
            scx=stage.stageWidth*.5;
            scy=stage.stageHeight*.5;
            //
            back=new MovieClip();
            back.x=scx;
            back.y=scy;
            back.lx=scx;
            back.ly=scy;
            mesh=new Mesh();
            mesh.x=mesh.width*-.1
            mesh.y=mesh.height*-.5
            back.addChild(mesh)
            addChild(back);
            //
            front=new MovieClip();
            front.x=scx;
            front.y=scy;
            front.lx=scx;
            front.ly=scy;
            mesh=new Mesh()
            mesh.scaleX=0.9;
            mesh.scaleY=mesh.scaleX;
            mesh.x=mesh.width*-.5;
            mesh.y=mesh.height*-.5;
            front.addChild(mesh)
            addChild(front);
            addEventListener(Event.ENTER_FRAME,ent);
            front.addEventListener(Event.ENTER_FRAME,mesh_ent)
            back.addEventListener(Event.ENTER_FRAME,mesh_ent)
        }
        //
        private function ent(evt:Event):void{
            var dsx:Number=-90*(scx-mouseX)/(0.5*stage.stageWidth);
            var dsy:Number=-90*(scx-mouseY)/(0.5*stage.stageHeight);
            front.lx=scx+dsx;
            front.ly=scy+dsy;
            back.lx=scx+dsx*0.3;
            back.ly=scy+dsy*0.3;
        }
        private function mesh_ent(evt:Event):void{
            var _mc:MovieClip=evt.currentTarget as MovieClip;
            var dx:Number=0.1*(_mc.lx-_mc.x)
            var dy:Number=0.1*(_mc.ly-_mc.y);
            _mc.x+=dx;
            _mc.y+=dy;
        }
    }
}

import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.Graphics;
import flash.display.BitmapData;
import flash.display.Bitmap;

class Mesh extends MovieClip {
    public function Mesh() {
        var i:uint;
        var j:uint;
        var k:uint;
        var shape:Sprite=new Sprite()
        //addChild(shape);
        for(k=0;k<30;k++){
            for(j=0;j<15;j++){
                for(i=0;i<10;i++){
                    var g:Graphics=shape.graphics;
                    g.lineStyle(1,0x000);
                    g.moveTo(30*(k%2)+60*j+3*i,30*k+0);
                    g.lineTo(30*(k%2)+60*j+3*i,30*k+30);
                    g.endFill()
                }
                
            }
        }
        var bmd:BitmapData=new BitmapData(shape.width,shape.height,true,0xFFFF);
        bmd.draw(shape)
        var bm:Bitmap=new Bitmap(bmd)
        addChild(bm);
    }
}