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

大きい画像(嘘)

精進します。
/**
 * Copyright kuma360 ( http://wonderfl.net/user/kuma360 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/gkC0
 */

//精進します。
package {
    
    import flash.display.*;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.filters.BlurFilter;
    import flash.filters.ColorMatrixFilter;
    import flash.net.URLRequest;
    import flash.system.LoaderContext;
    import org.papervision3d.cameras.Camera3D;
    import org.papervision3d.objects.primitives.Plane;
    import org.papervision3d.render.BasicRenderEngine;
    import org.papervision3d.scenes.Scene3D;
    import org.papervision3d.view.Viewport3D;
    
    public class Main extends Sprite {
        
        private var m_back:Sprite ;
        private var m_front:Sprite ;
        private var actor:Actor ;
        
        
        public function Main () {
            
            /////////////////////////////////////////////
            m_back = new Sprite ;
            var L1:Loader = new Loader;
            L1.contentLoaderInfo.addEventListener ( 
                Event.COMPLETE, 
                function ( e:Event ) :void {
                    var B:Bitmap = e.target.content as Bitmap ;
                    m_back.addChild ( B ) ;
                }
            ) ;
            L1.load ( new URLRequest ( "http://assets.wonderfl.net/images/related_images/2/26/26b9/26b90d732ffb282785823f39d48da3b82175cded" ) , new LoaderContext ( true ) ) ;
            
            
            /////////////////////////////////////////////
            m_front = new Sprite ;
            var L2:Loader = new Loader;
            L2.contentLoaderInfo.addEventListener ( 
                Event.COMPLETE, 
                function ( e:Event ) :void {
                    var B:Bitmap = e.target.content as Bitmap ;
                    m_front.addChild ( B ) ;
                }
            ) ;
            L2.load ( new URLRequest ( "http://assets.wonderfl.net/images/related_images/9/92/9226/9226df71f0fd63c319b77c57523dd6117918650e" ) , new LoaderContext ( true ) ) ;
            
            
            
            /////////////////////////////////////////////
            var viewport:Viewport3D = new Viewport3D( 0, 0, true );
            viewport.filters = [ new ColorMatrixFilter ( [ 1, 0, 0, 0, 0,   0, 1, 0, 0, 0,   .2, .2, 1, 0, 0,   0, 0, 0, 1, 0   ] ) ];
            
            addChild ( m_back ) ;
            addChild ( viewport );
            addChild ( m_front ) ;
            
            
            /////////////////////////////////////////////
            var plane:Plane = new Plane ( null , 100 , 100 , 1 , 1 ) ;
            actor = new Actor ;
            
            var scene:Scene3D = new Scene3D();
            scene.addChild ( plane );
            scene.addChild ( actor );
            
            var camera:Camera3D = new Camera3D();
            camera.x = -200;
            camera.y = 100;
            camera.z = 1000;
            camera.focus = 30 ;
            camera.lookAt ( plane ) ;
            
            var render:BasicRenderEngine = new BasicRenderEngine(); 
            
            
            ///////////////////
            addEventListener (
                Event.ENTER_FRAME ,
                function ():void {
                    actor.update () ;
                    render.renderScene ( scene , camera , viewport ) ;
                }
            ) ;
            
            stage.addEventListener (
                MouseEvent.CLICK,
                function ():void {
                    
                    scene.removeChild ( actor );
                    actor = null ;
                    
                    actor = new Actor ;
                    scene.addChild ( actor );
                    
                }
            ) ;
                
            
        }
        
        
    }
}


import flash.display.*;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.system.LoaderContext;
import org.papervision3d.core.math.Number3D;
import org.papervision3d.materials.BitmapMaterial;
import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.materials.utils.MaterialsList;
import org.papervision3d.objects.primitives.Cube;

class Actor extends Cube {
    
    private var m_I:Image ;
    private var m_v:Number3D ;
    
    public function Actor () {
        
        m_I = new Image ;
        m_v = new Number3D;
        
        var M1:BitmapMaterial = new BitmapMaterial ( m_I ) ;
        var M2:ColorMaterial  = new ColorMaterial ( 0x909090 ) ;
        var M3:ColorMaterial  = new ColorMaterial ( 0x000000 ) ;
        var ML:MaterialsList  = new MaterialsList ( { front:M1, back:M3, right:M2, left:M2, top:M2, bottom:M2 } ) ;
        super ( ML , 200 , 5 , 200 , 5 , 1 , 5 , 0 , 0 ) ;
        
        y = 500 ;
        
    }
    
    public function update():void {
        
        m_I.update() ;
        
        m_v.y -= .05 ;
        y += m_v.y ;
        if ( y < 55 ) {
            y = 55 ;
            m_v.y = - m_v.y * .25 ;
        }
        
    }
    
    public function get Img ():BitmapData {
        return m_I;
    }
    
}


class Image extends BitmapData {
    
    private var m_IL:ImageLoader ;
    
    public function Image () {
        
        super ( 375 , 300 , true , 0 ) ;
        
        m_IL = new ImageLoader ;
        
    }
    
    public function update ():void {
        
        this.fillRect ( this.rect , 0 ) ;
        this.draw ( m_IL ) ;
        
    }
    
    
}


class ImageLoader extends Sprite {
    
    private const _feed:String = "http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&size=M";
    private const _media:Namespace = new Namespace("http://search.yahoo.com/mrss/");
    private var m_Cnt:int = 0 ;
    
    public function ImageLoader() {
        
        var ldr:URLLoader = new URLLoader;
        ldr.addEventListener(Event.COMPLETE, function _load(e:Event):void {
            ldr.removeEventListener(Event.COMPLETE, _load);
            Loaded ( XML(ldr.data).._media::thumbnail.@url.toXMLString().split('\n') );
        });
        ldr.load ( new URLRequest ( _feed ) ) ;
        
    }
    
    private function Loaded ( $images:Array ) :void {
        
        for (var i:int = 0; i < $images.length; ++i) {
            var ldr:Loader;
            ldr = new Loader;
            ldr.contentLoaderInfo.addEventListener ( Event.COMPLETE , Loadcomp ) ;
            ldr.load ( new URLRequest ( $images [ i ] ) , new LoaderContext ( true ) ) ;
        }
        
    }
    
    private function Loadcomp ( e:Event ) :void {
        
        var data:Bitmap = e.target.content as Bitmap ;
        data.x = ( m_Cnt % 5) * 75 ;
        data.y = Math.floor ( m_Cnt / 5 ) * 75 ;
        ++ m_Cnt ;
        
        addChild ( data ) ;
        
    }
    
}