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 ProjectNya 14 Feb 2011
/**
 * Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/aHzp
 */

////////////////////////////////////////////////////////////////////////////////
// 板チョコ
////////////////////////////////////////////////////////////////////////////////

package {

    import flash.display.Sprite;
    import flash.display.BlendMode;

    [SWF(backgroundColor="#FFFFFF", width="465", height="465", frameRate="30")]

    public class Main extends Sprite {

        public function Main() {
            //Wonderfl.capture_delay(1);
            init();
        }

        private function init():void {
            var chocolate:Chocolate = new Chocolate(465, 465);
            addChild(chocolate);
            chocolate.x = int(465 - chocolate.width)/2;
            chocolate.y = int(465 - chocolate.height)/2;
            var label:Label = new Label(400, 80, 60, Label.CENTER);
            addChild(label);
            label.x = 32;
            label.y = 192;
            label.textColor = 0xFFFFFF;
            label.text = "チョコ♥注入!";
            label.blendMode = BlendMode.OVERLAY;
        }
        
    }

}


//////////////////////////////////////////////////
// Chocolateクラス
//////////////////////////////////////////////////

import flash.display.Sprite;

class Chocolate extends Sprite {
    private var _width:uint;
    private var _height:uint;

    public function Chocolate(w:uint, h:uint) {
        _width = w;
        _height = h;
        draw();
    }

    private function draw():void {
        var rows:uint = Math.ceil(_width/124);
        var cols:uint = Math.ceil(_height/64);
        for (var r:uint = 0; r < rows; r ++) {
            for (var c:uint = 0; c < cols; c ++) {
                var block:Block = new Block();
                addChild(block);
                block.x = 124*r;
                block.y = 64*c;
            }
        }
    }

}


//////////////////////////////////////////////////
// Blockクラス
//////////////////////////////////////////////////

import flash.display.Shape;
import frocessing.color.ColorHSV;

class Block extends Shape {
    private var color:ColorHSV;

    public function Block() {
        draw();
    }

    private function draw():void {
        color = new ColorHSV();
        color.h = 20;
        color.s = 1;
        color.v = 0.6;
        graphics.beginFill(color.value);
        graphics.drawRect(0, 0, 124, 64);
        graphics.endFill();
        color.s = 0.5;
        color.v = 0.7;
        graphics.beginFill(color.value);
        graphics.moveTo(0, 0);
        graphics.lineTo(10, 10);
        graphics.lineTo(110, 10);
        graphics.lineTo(120, 0);
        graphics.endFill();
        color.s = 0.75;
        color.v = 0.7;
        graphics.beginFill(color.value);
        graphics.moveTo(0, 0);
        graphics.lineTo(10, 10);
        graphics.lineTo(10, 50);
        graphics.lineTo(0, 60);
        graphics.endFill();
        color.s = 1;
        color.v = 0.5;
        graphics.beginFill(color.value);
        graphics.moveTo(0, 60);
        graphics.lineTo(10, 50);
        graphics.lineTo(110, 50);
        graphics.lineTo(120, 60);
        graphics.endFill();
        color.s = 1;
        color.v = 0.4;
        graphics.beginFill(color.value);
        graphics.moveTo(120, 0);
        graphics.lineTo(110, 10);
        graphics.lineTo(110, 50);
        graphics.lineTo(120, 60);
        graphics.endFill();
    }

}


//////////////////////////////////////////////////
// Labelクラス
//////////////////////////////////////////////////

import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFieldAutoSize;
import flash.text.AntiAliasType;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;

class Label extends Sprite {
    private var txt:TextField;
    private static var fontType:String = "_ゴシック";
    private var _width:uint = 20;
    private var _height:uint = 20;
    private var size:uint = 12;
    public static const LEFT:String = TextFormatAlign.LEFT;
    public static const CENTER:String = TextFormatAlign.CENTER;
    public static const RIGHT:String = TextFormatAlign.RIGHT;

    public function Label(w:uint, h:uint, s:uint = 12, align:String = LEFT) {
        _width = w;
        _height = h;
        size = s;
        draw(align);
    }

    private function draw(align:String):void {
        txt = new TextField();
        addChild(txt);
        txt.width = _width;
        txt.height = _height;
        txt.autoSize = align;
        txt.type = TextFieldType.DYNAMIC;
        txt.selectable = false;
        //txt.embedFonts = true;
        //txt.antiAliasType = AntiAliasType.ADVANCED;
        var tf:TextFormat = new TextFormat();
        tf.font = fontType;
        tf.size = size;
        tf.align = align;
        txt.defaultTextFormat = tf;
        textColor = 0x000000;
    }
    public function set text(param:String):void {
        txt.text = param;
    }
    public function set textColor(param:uint):void {
        txt.textColor = param;
    }

}