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 ranran_ranran_r 13 May 2012
    Embed
/**
 * Copyright ranran_ranran_r ( http://wonderfl.net/user/ranran_ranran_r )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/oqeb
 */

package {
    import flash.display.AVM1Movie;
    import flash.display.SimpleButton;
    import flash.text.TextField;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.text.TextFormat;
    
    public class FlashTest extends Sprite {
        static public const HAGE_1:String = 'ノノ). \n彡⌒ヾ \n@-0,,0 \n ゝア ガチャコンプリートでラッピースーツが貰えます! \n(|_|) \n|| ';
        static public const HAGE_2:String = '     .;;;. \n     γ⌒ミ \n__[警]0,,0-J \n  (  ) A ノ \n  (  )Vノ ) \n   | |  | | ';
        static public const BTN_1:String = '通報する';
        static public const BTN_2:String = '釈放する';
        private var _hage:Sprite;
        private var _hageTf:TextField;
        private var _btn:SimpleButton;
        private var _btnTf:TextField;
        private var _btnTf2:TextField;
        private var _flag:Boolean;
        private var _tick:uint;
        
        public function FlashTest() {
            super();
            // write as3 code here..
            addEventListener(Event.ADDED_TO_STAGE,
                function(event:Event):void
                {
                    removeEventListener(Event.ADDED_TO_STAGE, arguments.callee);
                    event.target._init();
                }
            );
        }
        
        private function _init():void
        {
            this._flag = false;
            this._tick = 0;
            this._createHage();
            this._createBtn();
        }
        
        private function _createHage():void
        {
            this._hage = new Sprite();
            
            var format:TextFormat = new TextFormat();
            format.size = 12;
            format.color = 0x000000;
            //format.font = 'MS Pゴシック';
            
            this._hageTf = new TextField();
            this._hageTf.setTextFormat(format);
            this._hageTf.defaultTextFormat = format;
            this._hageTf.multiline = true;
            //tf.autoSize = true;
            //this._hageTf.width = 300;
            this._hageTf.autoSize = 'center';
            this._hageTf.text = HAGE_1;
            this._hageTf.x = (stage.stageWidth - this._hageTf.width) / 2;
            this._hageTf.y = (stage.stageHeight - this._hageTf.height) / 2;
            this._hage.addChild(this._hageTf);
            this.addChild(this._hage);
        }

        private function _createBtn():void
        {
            this._btnTf = new TextField();
            this._btnTf.text = BTN_1;
            this._btnTf.autoSize = 'left';
            
            var hitState:Sprite = new Sprite();
            hitState.graphics.lineStyle(1, 0x000000, 1.0, true);
            hitState.graphics.drawRect(0, 0, this._btnTf.width, this._btnTf.height);
            hitState.graphics.endFill();
            hitState.addChild(this._btnTf);
            
            this._btnTf2 = new TextField();
            this._btnTf2.text = BTN_1;
            this._btnTf2.autoSize = 'left';
            
            var downState:Sprite = new Sprite();
            downState.graphics.beginFill(0x888888, 0.8);
            downState.graphics.drawRect(0, 0, _btnTf2.width, _btnTf2.height);
            downState.graphics.endFill();
            downState.graphics.lineStyle(1, 0x000000, 1.0, true);
            downState.graphics.drawRect(0, 0, _btnTf2.width, _btnTf2.height);
            downState.graphics.endFill();
            downState.addChild(_btnTf2);
            
            this._btn = new SimpleButton();
            this._btn.upState         = hitState;
            this._btn.overState     = downState;
            this._btn.downState     = hitState;
            this._btn.hitTestState = hitState;
            
            this._btn.addEventListener(MouseEvent.CLICK, this._onClick);
            
            this._btn.x = (stage.stageWidth - this._btn.width) / 2;
            this._btn.y = (stage.stageHeight - 100);
            
            this.addChild(this._btn);
        }
        
        private function _onClick(event:MouseEvent):void
        {
            if (this._flag)
            {
                if (this._tick > 2)
                {
                    this._hageTf.text = '(´・ω・`)らんらん♪';
                }
                else
                {
                    this._hageTf.text = HAGE_1;
                }
                this._btnTf.text = BTN_1;
                this._btnTf2.text = BTN_1;
            }
            else
            {
                if (this._tick > 2)
                {
                    this._hageTf.text = '(´・ω・`)そんなー';
                }
                else
                {
                    this._hageTf.text = HAGE_2;
                }
                this._btnTf.text = BTN_2;
                this._btnTf2.text = BTN_2;
                this._tick++;
            }
            this._flag = !this._flag;
        }

    }
}