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

湯けむりひよこ

まぁまぁ、皆さん、ゆったりしましょう。

背景の絵は同僚のR.Aさんに書いてもらいました。多謝。
Get Adobe Flash player
by Hiiragi 16 Mar 2011
package  
{
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.BitmapDataChannel;
    import flash.display.GradientType;
    import flash.display.Loader;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.geom.Matrix;
    import flash.geom.Point;
    import flash.net.URLRequest;
    import flash.system.LoaderContext;
    import flash.system.Security;
    
    /**
     * ...
     * @author Hiiragi
     */
    
    [SWF(width="465", height="465", frameRate="30", backgroundColor="0x99BBFF")]
    public class Smoke extends Sprite 
    {
        public static const CROSSDOMAIN:String = "http://melancholy.raindrop.jp/flash/crossdomain.xml";
      
        private var _canvas:BitmapData;
        
        private var _perlinNoiseBmpd:BitmapData;
        private var _gradientSprite:Sprite;
        private var _gradientBmpd:BitmapData;
        
        private var _offsetArray:Array;
        private var _offsetLength:int;
        private var _diffSpeed:Number;
        
        private var _bgLoader:Loader;
        
        private var _hiyoko:Hiyoko;
        
        public function Smoke() 
        {
            Security.loadPolicyFile(CROSSDOMAIN);
            
            if (stage) init();
            else this.addEventListener(Event.ADDED_TO_STAGE, init);
        }
        
        private function init(e:Event = null):void 
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);
            
            _diffSpeed = 4;
            
            _canvas = new BitmapData(this.stage.stageWidth, this.stage.stageHeight, true, 0x0);
            this.addChild(new Bitmap(_canvas));
            
            _perlinNoiseBmpd = new BitmapData(this.stage.stageWidth, this.stage.stageHeight, true, 0x0);
            
            _gradientSprite = new Sprite();
            var mtx:Matrix = new Matrix();
            mtx.createGradientBox(465, 465, Math.PI / 2);
            _gradientSprite.graphics.beginGradientFill(GradientType.LINEAR, [0xFFFFFF, 0xFFFFFF, 0xFFFFFF], [0, 0.9, 1], [0, 100, 255], mtx);
            _gradientSprite.graphics.drawRect(0, 0, this.stage.stageWidth, this.stage.stageHeight);
            _gradientSprite.graphics.endFill();
            
            _gradientBmpd = new BitmapData(this.stage.stageWidth, this.stage.stageHeight, true, 0x0);
            _gradientBmpd.draw(_gradientSprite);
            
            _offsetLength = 5;
            _offsetArray = [];
            
            for (var i:int = 0; i < _offsetLength; i++)
            {
                _offsetArray.push(new Point());
            }
                             
            //background
            _bgLoader = new Loader();
            _bgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, bgLoadComplete);
            _bgLoader.load(new URLRequest("http://melancholy.raindrop.jp/flash/wonderfl_5/bg.jpg"));
            
        }
        
        private function bgLoadComplete(e:Event):void 
        {
            _hiyoko = new Hiyoko(0, 100);
            
            _hiyoko.addEventListener(Event.COMPLETE, hiyokoLoadCompleteHandler);
        }
        
        private function hiyokoLoadCompleteHandler(e:Event):void 
        {
            _hiyoko.scaleX = _hiyoko.scaleY = 2;
            _hiyoko.x = this.stage.stageWidth / 2;
            _hiyoko.y = 350;
            
            initComplete();
        }
        
        private function initComplete(e:Event = null):void 
        {
            this.addChildAt(_bgLoader, 0);
            this.addChildAt(_hiyoko, 1);
            
            this.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
        }
        
        private function onEnterFrameHandler(e:Event):void 
        {
            //this.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
            
            
            _perlinNoiseBmpd.lock();
            _canvas.lock();
            
            _perlinNoiseBmpd.perlinNoise(_perlinNoiseBmpd.width, _perlinNoiseBmpd.height, _offsetLength, 100, true, true, 7, true, _offsetArray);
            
            _canvas.fillRect(_canvas.rect, 0xFFFFFFFF);
            _canvas.copyChannel(_perlinNoiseBmpd, _perlinNoiseBmpd.rect, new Point(), BitmapDataChannel.RED, BitmapDataChannel.ALPHA);
            
            var len:int = _offsetArray.length;
            for (var i:int = 0; i < len; i++)
            {
                _offsetArray[i].x += (i + 1) * _diffSpeed;
                _offsetArray[i].y += (i + 1) * _diffSpeed * (i % 2 * 2 - 1);
            }
            
            _canvas.merge(_gradientBmpd, _gradientBmpd.rect, new Point, 1, 0, 0, 50);
            
            _canvas.unlock();
            _perlinNoiseBmpd.unlock();
        }
        
    }

}


import flash.display.DisplayObject;
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
import flash.utils.ByteArray;

class Hiyoko extends Sprite
{
    private var maskX:int;
    private var maskY:int;
    
    private var _mask:Sprite;
    private var _loader:Loader;
    
    private var _contentByteArray:ByteArray;
    
    public function Hiyoko(maskX:int, maskY:int)
    {
        this.maskX = maskX;
        this.maskY = maskY;
        
        _loader = new Loader();
        _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
        this.addChild(_loader);
        _loader.load(new URLRequest("http://www.project-nya.jp/images/flash/chick.swf"));
    }
    
    private function onLoadComplete(e:Event):void 
    {
        _mask = new Sprite();
        _mask.graphics.beginFill(0);
        _mask.graphics.drawRect(-_loader.width / 2, -_loader.height - 15, _loader.width, _loader.height);
        _mask.graphics.endFill();
        this.addChild(_mask);
        _loader.mask = _mask;
        
        this.dispatchEvent(new Event(Event.COMPLETE));
        
    }
    
    
    
}