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

// forked from aftercider's \(☆'s'★)/スロット
package {
    import flash.events.KeyboardEvent;
    import flash.ui.Keyboard;
    import flash.events.Event;
    import flash.text.TextFormat;
    import flash.text.TextField;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        private const textArray:Array = ["^","゜"];
        private var textField:TextField;
        private var textFormat:TextFormat;
        private var frame:int=0;
        private var mes:TextField;
        
        public function FlashTest() {
            // write as3 code here..
            textField = new TextField();
            
            textField.width = 200;
            textField.height = 200;
            textField.x = (stage.stageWidth-100)/2;
            textField.y = (stage.stageHeight-100)/2;
            textFormat = new TextFormat(null,25,0x000000);
            stage.addChild(textField);
            
            mes = new TextField();
            mes.text = "Hit Enter...";
            mes.x = (stage.stageWidth-mes.textWidth)/2;
            mes.y = (stage.stageHeight+100)/2;
            stage.addChild(mes);
            
            stage.addEventListener(Event.ENTER_FRAME,onEnterFrame);
            stage.addEventListener(KeyboardEvent.KEY_DOWN,keyboardHandler);
        }
        private function onEnterFrame(e:Event):void{
            frame++;
            if(frame%3<1) return;
            textField.text = "(℃"+textArray[int(2*Math.random())]+" )";
            textFormat.color = int(0xffffff*Math.random());
            textFormat.size = 25+int(frame/10);
            textField.setTextFormat(textFormat);
            textField.width =textField.textWidth*1.2;
            textField.x = (stage.stageWidth - textField.textWidth)/2;
            textField.y = (stage.stageHeight-100)/2;
        }
        private var flag:Boolean = false;
        private function keyboardHandler(ke:KeyboardEvent):void{
            if(ke.charCode==13){
                if(flag)stage.addEventListener(Event.ENTER_FRAME,onEnterFrame);
                else stage.removeEventListener(Event.ENTER_FRAME,onEnterFrame);
                flag = !flag;
            }
        }


    }
}