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: forked from: Progression 4 BasicAppConfig

動いた
クリックでシーンチェンジ
クリック連打にも対応
/**
 * Copyright nium ( http://wonderfl.net/user/nium )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/vxtF
 */

// forked from northprint's forked from: Progression 4 BasicAppConfig
// forked from nium's Progression 4 BasicAppConfig
//動いた
//クリックでシーンチェンジ
//クリック連打にも対応

package {
    import flash.display.*;
    import jp.progression.config.*;
    import jp.progression.debug.*;
    import jp.progression.*;
    
    public class Index extends Sprite {
        
        public var manager:Progression;
        
        public function Index() {
            Progression.initialize( new BasicAppConfig() );
            manager = new Progression( "index", stage, IndexScene );
            
            //Debugger.addTarget( manager );
                        
            manager.goto( manager.root.sceneId );
        }
    }
}

import flash.net.*;
import flash.system.*;
import jp.progression.casts.*;
import jp.progression.commands.display.*;
import jp.progression.commands.lists.*;
import jp.progression.commands.net.*;
import jp.progression.commands.tweens.*;
import jp.progression.commands.managers.Goto;
import jp.progression.commands.*;
import jp.progression.data.*;
import jp.progression.events.*;
import jp.progression.scenes.*;
import jp.progression.executors.ExecutorObjectState;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.events.MouseEvent;

class IndexScene extends SceneObject {
    
    public function IndexScene() {
    }
    
    protected override function atSceneLoad():void {
        manager.stage.addEventListener(MouseEvent.CLICK, clickHandler);
        addCommand(
            new LoaderList(null,
                new LoadBitmapData(new URLRequest("http://assets.wonderfl.net/images/related_images/3/3e/3e3e/3e3e81e2e3ebefcc115e41ee5b95c2bb171e8019"), {context:new LoaderContext(true), group:"imageset"} ),
                new LoadBitmapData(new URLRequest("http://assets.wonderfl.net/images/related_images/6/62/6266/6266679ebb9179e0f434ccceed4cf0857bb7f8c9"), {context:new LoaderContext(true), group:"imageset"} )
            ),
            function():void {
                var count:int = int (getResourcesByGroup( "imageset" ).length);
                for (var i:int = 0; i < count; i++) {
                    var imageScene:ImageScene = new ImageScene("image" + i);
                    imageScene.title = "image" + String(i + 1);
                    imageScene.bitmapdata = getResourcesByGroup( "imageset" )[i].toBitmapData();
                    addScene(imageScene);
                }
            }

        );
    }
    protected override function atSceneInit():void {
        addCommand(
            new Goto(getSceneAt(0).sceneId)
        );
    }
    private function clickHandler(e:MouseEvent):void {
        if (manager.state > ExecutorObjectState.IDLING) {
            manager.stop();
        }
        if (manager.current.next) {
            manager.goto(manager.current.next.sceneId);
        } else {
            manager.goto(manager.root.scenes[0].sceneId);
        }
    }
}

class ImageScene extends SceneObject {
    private var _bitmap:Bitmap;
    private var _bitmapdata:BitmapData;
    public function ImageScene(name:String = null, initObject:Object = null) {
        super( name, initObject );
    }
    
    protected override function atSceneInit():void {
        _bitmap = new Bitmap();
        if (_bitmapdata) {
            _bitmap.bitmapData = _bitmapdata;
            _bitmap.alpha = 0;
            addCommand(
                new AddChild(container, _bitmap),
                new DoTweener(_bitmap, { alpha:1, time:1 } )
            );
        }
    }
    protected override function atSceneGoto():void {
        if (_bitmapdata) {
            addCommand(
                new RemoveChild(container, _bitmap)
            );
        }
    }
    public function set bitmapdata(value:BitmapData):void {
        _bitmapdata = value;
    }
}