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

forked from: Progression4 Professional

/**
 * Copyright yd_niku ( http://wonderfl.net/user/yd_niku )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/tI7c
 */

// forked from checkmate's Progression4 Professional
// forked from test_doke's flash on 2009-9-29
package {
        import caurina.transitions.Equations;
        import flash.display.*;
        import jp.progression.commands.*;
        import jp.progression.commands.display.*;
        import jp.progression.commands.lists.*;
        import jp.progression.commands.net.*;
        import jp.progression.commands.tweens.*;
        import jp.progression.*;
        
        import flash.events.*;
        import flash.geom.*;
        import flash.filters.*;

        [SWF( width=465, height=465, backgroundColor=0xFFFFFF, frameRate=30 )]
        public class Professional extends Sprite {

                public var manager:Progression, self:Professional;

                // Graphics
                public var scene1_Balloon1:MovieClip, scene1_Balloon2:MovieClip, scene1_Brother:MovieClip;
                public var scene2_Brother:MovieClip, scene2_Shout:MovieClip;
                public var scene3_Brother:MovieClip, scene3_CutIn1:MovieClip, scene3_CutIn2:MovieClip, scene3_SE:MovieClip, scene3_Sister:MovieClip;
                public var scene4_Balloon:MovieClip, scene4_Brother:MovieClip, scene4_Sister:MovieClip;



                // First Scene
                public function introduction():void {
                        manager.current.addCommand(
                                new RemoveAllChildren( self ),
                                [
                                        [
                                                new Prop( scene1_Brother, { y:435 } ),
                                                new AddChild( self, scene1_Brother ),
                                                new DoTweener( scene1_Brother, { y:335, time:7 } )
                                        ],
                                        [
                                                1,
                                                new Prop( scene1_Balloon1, { alpha:0 } ),
                                                new AddChild( self, scene1_Balloon1 ),
                                                new DoTweener( scene1_Balloon1, { alpha:1, time:1 } )
                                        ],
                                        [
                                                2,
                                                new Prop( scene1_Balloon2, { alpha:0 } ),
                                                new AddChild( self, scene1_Balloon2 ),
                                                new DoTweener( scene1_Balloon2, { alpha:1, time:1 } )
                                        ]
                                ]
                        );
                }

                // Second Scene
                private var _offsets:Point = new Point;
                private var _p:Point = new Point;
                private var _disp:DisplacementMapFilter = new DisplacementMapFilter( null, new Point, 1, 1, 0, 100  );
                public function development():void {
                        var noise:BitmapData = new BitmapData( 465, 465 );
                        
                        var effect:BitmapData = new BitmapData( 465, 465 );
                        effect.draw( this );
                        var melt:Function = function (e:Event ):void {
                            _offsets.x += 3;
                            _offsets.y += 3;
                            noise.perlinNoise( 16, 16, 2, 1, false, true, 1, false, [ _offsets ]);
                            _disp.mapBitmap = noise;
                            effect.applyFilter( effect, effect.rect, _p, _disp );
                            effect.colorTransform( effect.rect, new ColorTransform(0.9, 0.9, 0.9, 0.9 ) );
                        };
                        var effectContainer:Bitmap = new Bitmap(effect);
                        manager.current.addCommand(
                                new RemoveAllChildren( self ),
                                new AddChild( self, effectContainer ),
                                function():void {
                                    self.addEventListener( Event.ENTER_FRAME, melt );
                                },
                                new Wait( 2 ),
                                function ():void {
                                    self.removeEventListener( Event.ENTER_FRAME, melt );
                                },
                                new RemoveChild( self, effectContainer ),
                                [
                                        [
                                                new Prop( scene2_Brother, { scaleX:0.3, scaleY:0.3 } ),
                                                new AddChild( self, scene2_Brother ),
                                                new DoTweener( scene2_Brother, { scaleX:1, scaleY:1, time:1, transition:Equations.easeOutElastic } )
                                        ],
                                        [
                                                0.1,
                                                new Prop( scene2_Shout, { scaleX:0.3, scaleY:0.3 } ),
                                                new AddChild( self, scene2_Shout ),
                                                new DoTweener( scene2_Shout, { scaleX:1, scaleY:1, time:1, transition:Equations.easeOutElastic } )
                                        ]
                                ]
                        );
                }

                // Third Scene
                public function turn():void {
                        var noise:BitmapData = new BitmapData( 465, 465 );
                        
                        var effect:BitmapData = new BitmapData( 465, 465 );
                        effect.draw( this );
                        var melt:Function = function (e:Event ):void {
                            _offsets.x += 3;
                            _offsets.y += 3;
                            noise.perlinNoise( 16, 16, 2, 1, false, true, 1, false, [ _offsets ]);
                            _disp.mapBitmap = noise;
                            effect.applyFilter( effect, effect.rect, _p, _disp );
                            effect.colorTransform( effect.rect, new ColorTransform(0.9, 0.9, 0.9, 0.9 ) );
                        };
                        var effectContainer:Bitmap = new Bitmap(effect);
                        manager.current.addCommand(
                                new RemoveAllChildren( self ),
                                new AddChild( self, effectContainer ),
                                function():void {
                                    self.addEventListener( Event.ENTER_FRAME, melt );
                                },
                                new Wait( 2 ),
                                function ():void {
                                    self.removeEventListener( Event.ENTER_FRAME, melt );
                                },
                                new RemoveChild( self, effectContainer ),
                                [
                                        [
                                                new Prop( scene3_Brother, { x:130, scaleX:0.7, scaleY:0.7 } ),
                                                new AddChild( self, scene3_Brother ),
                                                new DoTweener( scene3_Brother, { x:230, scaleX:1, scaleY:1, time:1, transition:Equations.easeOutElastic } )
                                        ],
                                        [
                                                new Prop( scene3_Sister, { x:-300, scaleX:0.7, scaleY:0.7 } ),
                                                new AddChild( self, scene3_Sister ),
                                                new DoTweener( scene3_Sister, { x:0, scaleX:1, scaleY:1, time:1, transition:Equations.easeOutElastic } )
                                        ],
                                        new AddChild( self, scene3_CutIn1 ),
                                        new AddChild( self, scene3_CutIn2 ),
                                        [
                                                new Prop( scene3_SE, { scaleX:0.3, scaleY:0.3 } ),
                                                new AddChild( self, scene3_SE ),
                                                new DoTweener( scene3_SE, { scaleX:1, scaleY:1, time:1, transition:Equations.easeOutElastic } )
                                        ]
                                ]
                        );
                }

                // Fourth Scene
                public function conclusion():void {
                        var noise:BitmapData = new BitmapData( 465, 465 );
                        
                        var effect:BitmapData = new BitmapData( 465, 465 );
                        effect.draw( this );
                        var melt:Function = function (e:Event ):void {
                            _offsets.x += 3;
                            _offsets.y += 3;
                            noise.perlinNoise( 16, 16, 2, 1, false, true, 1, false, [ _offsets ]);
                            _disp.mapBitmap = noise;
                            effect.applyFilter( effect, effect.rect, _p, _disp );
                            effect.colorTransform( effect.rect, new ColorTransform(0.9, 0.9, 0.9, 0.9 ) );
                        };
                        var effectContainer:Bitmap = new Bitmap(effect);
                        manager.current.addCommand(
                                new RemoveAllChildren( self ),
                                new AddChild( self, effectContainer ),
                                function():void {
                                    self.addEventListener( Event.ENTER_FRAME, melt );
                                },
                                new Wait( 2 ),
                                function ():void {
                                    self.removeEventListener( Event.ENTER_FRAME, melt );
                                },
                                new RemoveChild( self, effectContainer ),
                                [
                                        [
                                                new Prop( scene4_Brother, { x:162, y:266, scaleX:1.5, scaleY:1.5 } ),
                                                new AddChild( self, scene4_Brother ),
                                                new DoTweener( scene4_Brother, { x:112, y:216, scaleX:1, scaleY:1, time:4, transition:Equations.easeOutCubic } )
                                        ],
                                        [
                                                1,
                                                new Prop( scene4_Sister, { x:416, y:505, scaleX:1.3, scaleY:1.3 } ),
                                                new AddChild( self, scene4_Sister ),
                                                new DoTweener( scene4_Sister, { x:316, y:485, scaleX:1, scaleY:1, time:3, transition:Equations.easeOutCubic } )
                                        ],
                                        [
                                                2,
                                                new Prop( scene4_Balloon, { rotation:-5, scaleX:0.7, scaleY:0.7 } ),
                                                new AddChild( self, scene4_Balloon ),
                                                new DoTweener( scene4_Balloon, { rotation:0, scaleX:1, scaleY:1, time:0.5, transition:Equations.easeOutElastic } )
                                        ]
                                ]
                        );
                }



                public function Professional() {
                        CheckmateBuilder.initialize( this );
                }
        }
}

class MeltEffectCommand extends Command {
    private  var effect:BitmapData;
    private  var noise:BitmapData;
    private var offsets:Point = new Point;
    private var p:Point = new Point;
    private var disp:DisplacementMapFilter = new DisplacementMapFilter( null, new Point, 1, 1, 0, 50  );
                
    public function MeltEffectCommand( container:DisplayObject ) {
        noise = new BitmapData( 465, 465 );
        effect = new BitmapData( 465, 465 );
        effect.draw( container);
        var effectContainer:Bitmap = new Bitmap(effect);
    }
    private function melt(e:Event ):void {
         offsets.x += 3;
         offsets.y += 3;
         noise.perlinNoise( 16, 16, 2, 1, false, true, 1, false, [ offsets ]);
         disp.mapBitmap = noise;
         effect.applyFilter( effect, effect.rect, p, disp );
         effect.colorTransform( effect.rect, new ColorTransform(0.9, 0.9, 0.9, 0.9 ) );
    }
    /*
        new AddChild( self, effectContainer ),
        function():void {
            self.addEventListener( Event.ENTER_FRAME, melt );
        },
        new Wait( 3 ),
        function ():void {]
            self.removeEventListener( Event.ENTER_FRAME, melt );
        },
        new RemoveChild( self, effectContainer ),
    */
}


import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.URLRequest;
import flash.system.ApplicationDomain;
import flash.text.*;
import flash.utils.Timer;
import jp.progression.casts.*;
import jp.progression.commands.*;
import jp.progression.commands.lists.*;
import jp.progression.commands.net.*;
import jp.progression.config.*;
import jp.progression.data.*;
import jp.progression.events.*;
import jp.progression.scenes.*;
import jp.progression.*;

class CheckmateBuilder extends EventDispatcher {

        public static var GRAPHICS_URL:String = "http://swf.wonderfl.net/static/assets/checkmate04/ProfessionalAssets.swf";

        private static var _target:Professional;
        private static var _manager:Progression;

        private static var _button:CastButton;

        public static function initialize( target:Professional ):void {
                if ( _target ) { return; }

                _target = target;
                _target.self = target;

                Progression.initialize( new BasicAppConfig() );
                _manager = new Progression( "index", _target.stage );

                var introduction:SceneObject = _manager.root.addScene( new SceneObject( "introduction" ) );
                var development:SceneObject = _manager.root.addScene( new SceneObject( "development" ) );
                var turn:SceneObject = _manager.root.addScene( new SceneObject( "turn" ) );
                var conclusion:SceneObject = _manager.root.addScene( new SceneObject( "conclusion" ) );

                _manager.root.addEventListener( SceneEvent.SCENE_LOAD, _rootSceneLoad );
                introduction.addEventListener( SceneEvent.SCENE_INIT, _introduction );
                development.addEventListener( SceneEvent.SCENE_INIT, _development );
                turn.addEventListener( SceneEvent.SCENE_INIT, _turn );
                conclusion.addEventListener( SceneEvent.SCENE_INIT, _conclusion );

                _target.manager = _manager;

                _manager.goto( introduction.sceneId );
        }

        private static function _rootSceneLoad( e:SceneEvent ):void {
                _manager.current.addCommand(
                        new LoadSWF( new URLRequest( GRAPHICS_URL ) ),
                        function():void {
                                var loader:Loader = Loader( this.latestData );
                                var domain:ApplicationDomain = loader.contentLoaderInfo.applicationDomain;

                                _target.scene1_Balloon1 = new ( domain.getDefinition( "scene1.Balloon1" ) as Class );
                                _target.scene1_Balloon1.x = 106;
                                _target.scene1_Balloon1.y = 233;

                                _target.scene1_Balloon2 = new ( domain.getDefinition( "scene1.Balloon2" ) as Class );
                                _target.scene1_Balloon2.x = 345;
                                _target.scene1_Balloon2.y = 270;

                                _target.scene1_Brother = new ( domain.getDefinition( "scene1.Brother" ) as Class );
                                _target.scene1_Brother.x = 228;
                                _target.scene1_Brother.y = 335;

                                _target.scene2_Brother = new ( domain.getDefinition( "scene2.Brother" ) as Class );
                                _target.scene2_Brother.x = 200;
                                _target.scene2_Brother.y = 475;

                                _target.scene2_Shout = new ( domain.getDefinition( "scene2.Shout" ) as Class );
                                _target.scene2_Shout.x = 240;
                                _target.scene2_Shout.y = 215;

                                _target.scene3_Brother = new ( domain.getDefinition( "scene3.Brother" ) as Class );
                                _target.scene3_Brother.x = 230;
                                _target.scene3_Brother.y = 348;

                                _target.scene3_CutIn1 = new ( domain.getDefinition( "scene3.CutIn1" ) as Class );
                                _target.scene3_CutIn1.x = -226;
                                _target.scene3_CutIn1.y = -70;

                                _target.scene3_CutIn2 = new ( domain.getDefinition( "scene3.CutIn2" ) as Class );
                                _target.scene3_CutIn2.x = -226;
                                _target.scene3_CutIn2.y = 312;
                                _target.scene3_SE = new ( domain.getDefinition( "scene3.SE" ) as Class );
                                _target.scene3_SE.x = 259;
                                _target.scene3_SE.y = 237;

                                _target.scene3_Sister = new ( domain.getDefinition( "scene3.Sister" ) as Class );
                                _target.scene3_Sister.x = 0;
                                _target.scene3_Sister.y = 387;

                                _target.scene4_Balloon = new ( domain.getDefinition( "scene4.Balloon" ) as Class );
                                _target.scene4_Balloon.x = 185;
                                _target.scene4_Balloon.y = 370;

                                _target.scene4_Brother = new ( domain.getDefinition( "scene4.Brother" ) as Class );
                                _target.scene4_Brother.x = 112;
                                _target.scene4_Brother.y = 216;

                                _target.scene4_Sister = new ( domain.getDefinition( "scene4.Sister" ) as Class );
                                _target.scene4_Sister.x = 316;
                                _target.scene4_Sister.y = 485;

                                var frameBorder:MovieClip = new ( domain.getDefinition( "ui.FrameBorder" ) as Class );

                                var nextButton:MovieClip = new ( domain.getDefinition( "ui.NextButton" ) as Class );
                                nextButton.managerId = "index";
                                nextButton.x = 435;
                                nextButton.y = 30;
                                nextButton.addEventListener( CastMouseEvent.CAST_NAVIGATE_BEFORE, _castNavigateBefore );

                                var previousButton:MovieClip = new ( domain.getDefinition( "ui.PreviousButton" ) as Class );
                                previousButton.managerId = "index";
                                previousButton.x = 30;
                                previousButton.y = 30;
                                previousButton.addEventListener( CastMouseEvent.CAST_NAVIGATE_BEFORE, _castNavigateBefore );

                                _target.stage.addChild( frameBorder );
                                _target.stage.addChild( nextButton );
                                _target.stage.addChild( previousButton );
                        }
                );
        }

        private static function _introduction( e:SceneEvent ):void {
                _target.introduction();
        }

        private static function _introductionInit( e:SceneEvent ):void {
                _target.introduction();
        }

        private static function _development( e:SceneEvent ):void {
                _target.development();
        }

        private static function _turn( e:SceneEvent ):void {
                _target.turn();
        }

        private static function _conclusion( e:SceneEvent ):void {
                _target.conclusion();
        }

        private static function _castNavigateBefore( e:CastMouseEvent ):void {
                _target.manager.stop();
        }
}