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 Nowloading_ ( http://wonderfl.net/user/Nowloading_ )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/dFVG
 */

package {
    import org.papervision3d.materials.*;
    import org.papervision3d.objects.primitives.*;
    import org.papervision3d.view.*;
    import org.papervision3d.events.*;
    import flash.events.*;
    [SWF(backgroundColor = 0x000000)]
    public class testmePV3D extends BasicView {
        private var material:ColorMaterial = new ColorMaterial(0xff0000);
        private var material2:ColorMaterial = new ColorMaterial(0xffff00);
        private var plane:Plane = new Plane(material,200,200);
        private var rad:int = 0;
        private var rad2:int = 30;
        private var m:mado;
        private var ma:int = 0;
        public function testmePV3D() {
            //extends BasicViewでMouseEventを登録する設定
            //viewportと仕様マテリアルのinteractiveをtrueにする
            super(465,465,true,true);
            material.interactive = true;
            camera.x = 0;
            camera.y = 500;
            camera.z = -500;
            init();
        }
        private function init():void{
            material.doubleSided = true;
            material2.doubleSided = true;
            scene.addChild(plane);
            plane.y = 200;
            startRendering();
            addEventListener(Event.ENTER_FRAME,oEF);
            plane.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK,oOC);
        }
        private function oMC(e:Event):void{
            if(ma==1){
                removeChild(m);
                ma = 0;
            }
        }
        private function oEF(e:Event):void{
            camera.z = -500*Math.cos(rad*Math.PI/180);
            camera.x = 500*Math.sin(rad*Math.PI/180);
            rad += 3;
            if(rad >= 360)
                rad = 0;
        }
        private function oOC(e:Event):void{
            plane.rotationY += 10;
            var color:uint = Math.random()*0xffffff;
            if(ma == 1){
                removeChild(m);
                ma = 0;
            }
            if(ma == 0){
                m = new mado();
                m.x = mouseX;
                m.y = mouseY;
                addChild(m);
                m.buttons[2].addEventListener(MouseEvent.CLICK,oMC);
                ma = 1;
            }
        }
    }
}

import flash.display.Sprite;
import flash.events.*;
class mado extends Sprite{
    public var buttons:Array = new Array();
    public var txt:Array = ["移動","たたかう","閉じる"];
    public var tf:mozi;
    private var sprite:Sprite;
    public var spr1:Sprite;
    public var spr2:Sprite;
    public function mado(){
        init();
    }
    private function init():void{
        //下地の描画
        graphics.lineStyle(0,0xfadfbf);
        graphics.beginFill(0xfadfbf);
        graphics.drawRoundRect(0,0,100,120,5,5);
        graphics.endFill();
        graphics.lineStyle(2,0xba9f7f);
        graphics.moveTo(3,3);
        graphics.lineTo(97,3);
        graphics.moveTo(3,113);
        graphics.lineTo(97,113);
        graphics.moveTo(3,117);
        graphics.lineTo(97,117);
        for(var i:int = 0; i<3; i++){
            sprite = new Sprite();
            sprite.graphics.lineStyle(1,0xff9999,0.3);
            sprite.graphics.beginFill(0xff9999,0.3);
            sprite.graphics.drawRect(5,8,90,30);
            sprite.graphics.endFill();
            addChild(sprite);
            sprite.y = i*34;
            //以下を書くとテキスト上でもハンドカーソルになる
            sprite.mouseChildren = false;
            tf = new mozi(txt[i]);
            sprite.addChild(tf);
            sprite.buttonMode = true;
            buttons[i] = sprite;
        }
    }
}

import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
class mozi extends TextField{
    private var tf:TextFormat = new TextFormat();
    public function mozi(txt:String){
        width = 80;
        height = 30;
        y = 13;
        x = 2;
        autoSize = TextFieldAutoSize.LEFT
        tf.size = 24;
        tf.color = 0x000000;
        defaultTextFormat = tf;
        text = txt;
    }
}