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

ぴこっぴこっ

なんかクリックすると消える
Get Adobe Flash player
by Kihara 05 Jan 2011
/**
 * Copyright Kihara ( http://wonderfl.net/user/Kihara )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/76GM
 */

package
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;

    import org.papervision3d.events.InteractiveScene3DEvent;
    import org.papervision3d.materials.ColorMaterial;
    import org.papervision3d.objects.primitives.Plane;
    import org.papervision3d.view.BasicView;

    public class mesh_game extends BasicView
    {

        private var plane:Vector.<Moji>=new Vector.<Moji>;
        private const N:uint=80;
        private var str:String="abcdefghijklmnopqrstuvwxyz";
        private var word3d:Vector.<Text3d>=new Vector.<Text3d>;
        private var count:uint=0;
        private var vec_p:Vector.<Plane>=new Vector.<Plane>;


        public function mesh_game()
        {
            super(0, 0, true, true);
            var r:Number, n:int, ss:String, w:Text3d;
            var mat:ColorMaterial=new ColorMaterial(0x000000, 0);
            mat.interactive=true;
            camera.z=0;

            for (var i:uint=0; i < N; i++)
            {
                r=Math.random() * 25;
                n=r;
                ss=str.charAt(n);
                w=new Text3d(ss, false);

                word3d.push(w);
                var p:Plane=new Plane(mat, 70, 70);

                p.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, onClick);
                vec_p.push(p);
            }

            addEventListener(Event.ENTER_FRAME, onEnterFrame);
            startRendering();

        }

        public function onClick(e:InteractiveScene3DEvent):void
        {
            var id:int=int(Plane(e.currentTarget).extra);
            word3d[id].flag=false;
        }

        public function searchWord():int
        {
            for (var i:uint=0; i < word3d.length; i++)
            {
                if (!word3d[i].flag)
                    return i;
            }
            return -1;
        }

        public function flagWord():void
        {
            var i:Number;
            if ((i=searchWord()) != -1)
            {
                word3d[i].word.x=Math.random() * 500 - 250;
                word3d[i].word.y=Math.random() * 500 - 250;
                word3d[i].word.z=2000;
                vec_p[i].x=word3d[i].word.x;
                vec_p[i].y=word3d[i].word.y - 15;
                vec_p[i].z=word3d[i].word.z - 1;

                word3d[i].flag=true;

                vec_p[i].extra=i;
                scene.addChild(vec_p[i]);
                scene.addChild(word3d[i].word);
                    
            }
        }

        public function moveWord():void
        {
            for (var i:uint=0; i < word3d.length; i++)
            {
                if (word3d[i].flag)
                {
                    word3d[i].word.z-=10;
                    vec_p[i].z-=10;

                    if (word3d[i].word.z <= -10)
                    {
                        word3d[i].flag=false;
                        scene.removeChild(word3d[i].word);
                        scene.removeChild(vec_p[i]);
                            
                    }
                }
                else if (!word3d[i].flag && word3d[i].z < 2000)
                {
                    scene.removeChild(word3d[i].word);
                    scene.removeChild(vec_p[i]);
                }
            }
        }

        public function onEnterFrame(e:Event):void
        {
            count++;
            if (count % 12 == 0)
                flagWord();
            moveWord();
        }
    }
}


import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.materials.special.Letter3DMaterial;
import org.papervision3d.typography.Text3D;
import org.papervision3d.typography.fonts.HelveticaBold;
import flash.display.Sprite;
class Text3d extends Sprite
{
    public var s:String;
    public var flag:Boolean;
    public var word:Text3D;

    public function Text3d(s:String, flag:Boolean)
    {
        this.s=s;
        this.flag=flag;
        var mat:Letter3DMaterial=new Letter3DMaterial(0x000000);
        var font:HelveticaBold=new HelveticaBold();
        mat.doubleSided=true;
        mat.interactive=true;
        word=new Text3D(s, font, mat);
    }

}


import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.text.AntiAliasType;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;

import org.papervision3d.materials.BitmapMaterial;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.primitives.Plane;

class Moji extends Sprite
{

    public var obj:DisplayObject3D;
    public var flag:Boolean;
    public var str:String;

    public function Moji(flag:Boolean, str:String)
    {
        this.flag=flag;
        this.str=str;

        var bmp:BitmapData=sp_func();
        var mat:BitmapMaterial=new BitmapMaterial(bmp);
        mat.doubleSided=true;
        mat.interactive=true;

        obj=new Plane(mat, 50, 100, 1, 2);

    }

    private function sp_func():BitmapData
    {
        var sp:Sprite=new Sprite();
        var text:TextField=text_func();

        sp.addChild(text);
        var bmp:BitmapData=new BitmapData(text.width, text.height);
        bmp.draw(sp);
        var bm:Bitmap=new Bitmap(bmp);
        bm.smoothing=true;
        var bmpData:BitmapData=bm.bitmapData;

        return bmpData;
    }

    private function text_func():TextField
    {
        var tf:TextFormat=new TextFormat();
        var text:TextField=new TextField();

        tf.font="Arial";
        tf.size=32;

        text.antiAliasType=AntiAliasType.ADVANCED;
        text.autoSize=TextFieldAutoSize.LEFT;
        text.defaultTextFormat=tf;
        text.text=str;

        return text;
    }
}