※現在、「wonderfl build flash online」求人コンテンツ制作に関してのアンケートを実施中です!みなさまのお力添えを頂いて、続々とアンケート結果が集まっていますが、まだまだ募集しております。ご協力のほど、どうぞよろしくお願いいたします!
wonderfl運営事務局
→アンケートページ(※ログインしてからお答えいただけるようになっています。)
progression4
プログレッション のテンプレート
テンプレート
Progression4まだ3もちゃんと使えてないけど、、
Progression4Progression4のテンプレートファイル
P4テンプレ
Progression4を試してみるには最適なテンプレートコード
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 FlashTest extends Sprite {
- public var manager:Progression;
- public function FlashTest() {
- Progression.initialize( new BasicAppConfig() );
- manager = new Progression( "index", stage, IndexScene );
- Debugger.addTarget( manager );
- manager.goto( manager.root.sceneId );
- }
- }
- }
- 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.*;
- import jp.progression.data.*;
- import jp.progression.events.*;
- import jp.progression.scenes.*;
- import flash.net.URLRequest;
- class IndexScene extends SceneObject {
- private var _loader:CastImageLoader;
- private var _url:String = "http://assets.wonderfl.net/images/related_images/c/cd/cdf0/cdf084da0fe7c1a04fe340a74a917ee9ee400302"
- public function IndexScene() {
- }
- protected override function atSceneLoad():void {
- addCommand(
- );
- }
- protected override function atSceneInit():void {
- addCommand(
- function():void {
- _loader = new CastImageLoader();
- //_loader.x = 100;
- //_loader.y = 100;
- //_loader.align = CastImageLoaderAlign.TOP_LEFT;
- //_loader.ratio = CastImageLoaderRatio.OVERFLOW;
- //_loader.adjustWidth = 150;
- //_loader.adjustHeight = 100;
- _loader.load(new URLRequest(_url));
- }
- ,new AddChild(container, _loader)
- );
- }
- protected override function atSceneGoto():void {
- addCommand(
- );
- }
- }
Progression 4 BasicAppConfig TweenButton
- /*
- * Progression4での話。
- *
- * 最近、微妙に振る舞いの違うボタンをいくつか作る必要があった。
- * トグルボタン、ラジオボタン、それらをハイブリッドみたいなボタン。
- * なるべく共通化してたんだけど、やっぱり作り進むうちに、
- * 違いが出て来てしまって、差し替え時にミスをしがちになった。
- *
- * 汎用的なボタンを作るか、インターフェイスを用いるべきだったんだと思った。
- *
- * とりあえず、普通、トグル、ラジオに対応するボタンを作ってみた。
- */
- // forked from nium's Progression 4 BasicAppConfig
- package {
- import flash.display.*;
- import jp.progression.config.*;
- import jp.progression.debug.*;
- import jp.progression.*;
- public class Main extends Sprite {
- public var manager:Progression;
- public function Main() {
- Progression.initialize( new BasicAppConfig() );
- manager = new Progression( "index", stage, IndexScene );
- //Debugger.addTarget( manager );
- manager.goto( manager.root.sceneId );
- }
- }
- }
- import flash.display.*;
- import flash.net.URLRequest;
- import jp.progression.casts.*;
- 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.data.*;
- import jp.progression.events.*;
- import jp.progression.scenes.*;
- class IndexScene extends SceneObject {
- public function IndexScene() {
- //デフォルト
- new TweenButton( { id:"tweenButton0", x:50, y:50 } );
- //デフォルト+文字+ダウンイメージを使わない
- new TweenButton( { id:"tweenButton1", x:50, y:100 },{text:"Button",isUseDownImage:false} );
- //トグル+tweenの時間設定+文字のせ
- new TweenButton( { id:"tweenButton2", x:50, y:200 }, { isToggle:true, time:0.3, text:"トグル" } );
- //on/offで違う文字のせ+初期状態でon
- new TweenButton( { id:"tweenButton3", x:50, y:250 }, { isToggle:true, onText:"ON", offText:"OFF", isOn:true } );
- //ラジオボタンの設定+tween無+selected
- var group:Array = ["radio0", "radio1", "radio2"];
- new TweenButton( { id:"radio0", x:50, y:350 }, { text:"Radio0", radioGroup:group, time:0 , selected:true } );
- new TweenButton( { id:"radio1", x:150, y:350 }, { text:"Radio1", radioGroup:group, time:0 } );
- new TweenButton( { id:"radio2", x:250, y:350 }, { text:"Radio2", radioGroup:group, time:0 } );
- //画像のボタン
- var offUpImg:CastImageLoader = new CastImageLoader();
- offUpImg.load(new URLRequest("http://farm3.static.flickr.com/2499/3828917483_8948414d57_o.jpg"));
- var offOverImg:CastImageLoader = new CastImageLoader();
- offOverImg.load(new URLRequest("http://farm3.static.flickr.com/2664/3828917495_8e21ea52c1_o.jpg"));
- var offDownImg:CastImageLoader = new CastImageLoader();
- offDownImg.load(new URLRequest("http://farm4.static.flickr.com/3542/3829716284_3f77a81e73_o.jpg"));
- new TweenButton( { id:"tweenButton4", x:200, y:50 }, { offUp:offUpImg, offOver:offOverImg,offDown:offDownImg } );
- }
- protected override function atSceneLoad():void {
- addCommand(
- new AddChild(container, "tweenButton0"),
- new AddChild(container, "tweenButton1"),
- new AddChild(container, "tweenButton2"),
- new AddChild(container, "tweenButton3"),
- new AddChild(container, "radio0"),
- new AddChild(container, "radio1"),
- new AddChild(container, "radio2"),
- new AddChild(container, "tweenButton4"),
- "Progression 4"
- );
- }
- protected override function atSceneInit():void {
- addCommand(
- "BasicAppConfig Test"
- );
- }
- protected override function atSceneGoto():void {
- addCommand(
- );
- }
- }
- import flash.display.Shape;
- import flash.geom.Matrix;
- import flash.text.TextField;
- import flash.display.Bitmap;
- class TweenButton extends CastButton {
- private var _offUp:DisplayObject;
- private var _offOver:DisplayObject;
- private var _offDown:DisplayObject;
- private var _onUp:DisplayObject;
- private var _onOver:DisplayObject;
- private var _onDown:DisplayObject;
- private var _up:CastSprite;
- private var _over:CastSprite;
- private var _down:CastSprite;
- private var _isOn:Boolean;
- private var _selected:Boolean;
- private var _isImageSwap:Boolean;
- //Downボタンを用意しない場合も多いので、
- //無くてもダミーが表示しないようにするには
- //isUseDownImage = false;にする。
- private var _isUseDownImage:Boolean = true;
- //tweenの時間。0にするとtweenerの呼び出しもない
- private var _time:Number = 0.6;
- private var _isToggle:Boolean;
- private var _text:String;
- private var _onText:String;
- private var _offText:String;
- private var _radioGroup:Array;
- private var _initialized:Boolean;
- public function TweenButton( initObject:Object = null , extendsObject:Object = null) {
- super(initObject);
- if (extendsObject) {
- for (var str:String in extendsObject) {
- this["_" + str] = extendsObject[str];
- }
- }
- if (!_onText) {
- _onText = _text?_text:null;
- }
- if (!_offText) {
- _offText = _text?_text:null;
- }
- if (_isToggle) {
- if (!_onUp) {
- _onUp = getImage(0xFFFF00, _onText);
- }
- if (!_onOver){
- _onOver = getImage(0x00FFFF, _onText);
- }
- if (!_onDown && _isUseDownImage){
- _onDown = getImage(0xFF00FF, _onText, 1);
- }
- }
- if (!_offUp) {
- _offUp = getImage(0xFF0000, _offText);
- }
- if (!_offOver) {
- _offOver = getImage(0x00FF00, _offText);
- }
- if (!_offDown && _isUseDownImage) {
- _offDown = getImage(0x0000FF, _offText, 1);
- }
- _isImageSwap = true;
- this.buttonMode = true;
- _up = new CastSprite();
- _over = new CastSprite();
- if(_offDown && _onDown){
- _down = new CastSprite();
- }else if (_offDown) {
- if (!_isToggle) {
- _down = new CastSprite();
- }
- }
- _up.addChild(_offUp);
- _over.addChild(_offOver);
- if (_up) {
- this.addChild(_up);
- _up.visible = true;
- }
- if (_over) {
- this.addChild(_over);
- _over.visible = false;
- }
- if (_down) {
- _down.addChild(_offDown);
- this.addChild(_down);
- _down.visible = false;
- }
- //初騎状態を設定
- this.isOn = _isOn;
- this.selected = _selected;
- _initialized = true;
- }
- private function getImage(rgb:int = 0xFF0000, text:String = null, ty:Number = 0):Bitmap {
- var shape:Shape = new Shape();
- shape.graphics.beginFill(rgb,0.5);
- shape.graphics.drawRoundRect(0,0,60,20,8,8);
- shape.graphics.endFill();
- shape.graphics.beginFill(rgb,0.5);
- shape.graphics.drawRoundRect(2,2,56,16,6,6);
- shape.graphics.endFill();
- var bitmapData:BitmapData = new BitmapData(shape.width, shape.height);
- bitmapData.draw(shape);
- if(text){
- var textField:TextField = new TextField();
- textField.text = text;
- textField.width = shape.width;
- textField.autoSize = "center";
- bitmapData.draw(textField, new Matrix(1, 0, 0, 1, 0, ty));
- }
- return new Bitmap(bitmapData);
- }
- //選択状態を維持する用
- public function get selected():Boolean { return _selected };
- public function set selected(value:Boolean):void {
- if (_initialized && _selected == value) { return };
- _selected = value;
- if (_over || _down) {
- if(_over){
- _over.visible = value;
- }
- if(_down){
- _down.visible = value;
- }
- _isImageSwap = !value;
- }
- this.mouseEventEnabled = !value;
- this.mouseEnabled = !value;
- }
- //ボタンとして機能するんだけど、イメージの差し替えはしない時用
- public function get isImageSwap():Boolean { return _isImageSwap };
- public function set isImageSwap(value:Boolean):void {
- if (_isImageSwap == value) { return };
- _isImageSwap = value;
- }
- //トグルが効いているときに画像の差し替えをする
- //onを表示しているときには、trueを返す。
- public function get isOn():Boolean { return _isOn };
- public function set isOn(value:Boolean):void {
- if (_initialized && _isOn == value) { return };
- _isOn = value;
- if (!_isToggle) { return };
- _up.removeAllChildren();
- _over.removeAllChildren();
- if(_down){
- _down.removeAllChildren();
- }
- if (value) {
- _up.addChild(_onUp);
- _over.addChild(_onOver);
- if(_down){
- _down.addChild(_onDown);
- }
- }else {
- _up.addChild(_offUp);
- _over.addChild(_offOver);
- if(_down){
- _down.addChild(_offDown);
- }
- }
- }
- //トグルを使う場合はtrueにする。
- public function get isToggle():Boolean { return _isToggle };
- public function set isToggle(value:Boolean):void {
- if (_isToggle == value) { return };
- _isToggle = value;
- }
- override protected function atCastMouseUp():void {
- if (_isImageSwap) {
- isOn = !isOn;
- if (_down) {
- _down.visible = false;
- //downが無いときに連続のクリックの時にわかりやすくするには、
- //_overを消すといいかも。
- //}else {
- //if (_over) {
- //_over.visible = false;
- //}
- }
- }
- //ラジオボタン用のグループがある場合に、自分以外を非selected表示に
- if (_radioGroup) {
- var n:int = _radioGroup.length;
- for (var i:int = 0; i < n; i++) {
- if ((getInstanceById(_radioGroup[i]) as TweenButton) != this) {
- (getInstanceById(_radioGroup[i]) as TweenButton).selected = false;
- }
- }
- this.selected = true;
- }
- }
- override protected function atCastMouseDown():void {
- if (_isImageSwap) {
- if (_down) {
- _down.visible = true;
- }else {
- //連続のクリックの時にはわかりにくいので、表示
- if (_over) {
- _over.visible = true;
- }
- }
- }
- }
- override protected function atCastRollOver():void {
- if (_isImageSwap) {
- if (_over) {
- if (_time > 0) {
- var sList:SerialList = new SerialList();
- sList.addCommand(
- function():void {
- _over.visible = true;
- _over.alpha = 0;
- },
- new DoTweener(_over,{alpha:1, time:_time, transition:"easeOutQuart"})
- );
- sList.execute();
- }else {
- _over.alpha = 1;
- _over.visible = true;
- }
- }
- }
- }
- override protected function atCastRollOut():void {
- if (_isImageSwap) {
- if (_over) {
- if (_time > 0) {
- var sList:SerialList = new SerialList();
- sList.addCommand(
- new DoTweener(_over,{alpha:0, time:_time, transition:"easeOutQuart"}),
- function():void {
- _over.visible = false;
- }
- );
- sList.execute();
- }else {
- _over.visible = false;
- }
- }
- }
- }
- }
Progression 4 BasicAppConfig Proggression4のコマンドの勉強中
- // forked from nium's Progression 4 BasicAppConfig
- // 基本的なコマンドをいろいろ試してみる(途中)
- package {
- import flash.display.*;
- import jp.progression.config.*;
- import jp.progression.debug.*;
- import jp.progression.*;
- public class FlashTest extends Sprite {
- public var manager:Progression;
- public function FlashTest() {
- Progression.initialize( new BasicAppConfig() );
- manager = new Progression( "index", stage, IndexScene );
- //Debugger.addTarget( manager );
- manager.goto( manager.root.sceneId );
- }
- }
- }
- import flash.text.TextField;
- import flash.text.TextFieldAutoSize;
- 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.*;
- import jp.progression.data.*;
- import jp.progression.events.*;
- import jp.progression.scenes.*;
- //DoTweenの効果用にインポート
- import fl.transitions.easing.*;
- //DoTweenerで色の変化効果をつけるときにこのクラスをインポートする(初期化が必要)
- import caurina.transitions.properties.ColorShortcuts;
- //DoTransitionを使うときにインポートする
- import fl.transitions.*;
- class IndexScene extends SceneObject {
- private var _tf:TextField;
- private var _sp1:TestSprite = new TestSprite("0x00DDDDDD");
- private var _sp2:TestSprite = new TestSprite("0x00BBBBBB");
- private var _sp3:TestSprite = new TestSprite("0x00999999");
- private var _mc1:TestMovieClip = new TestMovieClip();
- public function IndexScene() {
- _tf = new TextField();
- _tf.text = "出力";
- //TweenerでColorShortcuts使う時は初期化必須
- ColorShortcuts.init();
- }
- private function debug(message:*):void {
- //_tf.text = message;
- _tf.appendText("\n" + String(message));
- }
- protected override function atSceneLoad():void {
- var com:Prop = new Prop(_sp1, {x:stage.stageWidth/2-_sp1.width/2, y:stage.stageHeight/2-_sp1.height/2});
- com.execute();
- //カンマでつなぐとシリアル、[]で囲うとパラレル
- addCommand(
- //Progressionの出力
- //new Trace("hogehoge"),
- //表示リストに追加
- //addChild(コンテナ、オブジェクト)
- new AddChild(container,_tf),
- //関数の実行
- //Func(関数、引数:Array、処理の終了イベント:IEventDispatcher、発行される終了イベントの種類:String)
- new Func(debug,["途中で関数実行"]),
- //遅延処理
- //Wait(秒)←ミリ秒じゃないので注意
- new Wait(.5),
- //同時に処理(パラレル)
- //[]で囲う。閉じタグの後のカンマのつけ忘れに注意
- [
- new Func(debug,["同時に処理1"]),
- new Wait(.5),
- new Func(debug,["同時に処理2"])
- ],
- //プロパティーの設定
- //Prop(オブジェクト、パラメータ)
- //new Prop(_sp1,{x:stage.stageWidth/2-_sp1.width/2, y:stage.stageHeight/2-_sp1.height/2}),
- new Prop(_sp2,{x:stage.stageWidth/2-_sp2.width/2+20, y:stage.stageHeight/2-_sp2.height/2+20}),
- new Prop(_sp3,{x:stage.stageWidth/2-_sp3.width/2+40, y:stage.stageHeight/2-_sp3.height/2+40}),
- //テスト
- new Func(debug,["_sp1.x : "+_sp1.x]),//execute()で実行しないと対象のオブジェクトのプロパティーには影響してない?
- new Func(debug,["_sp2.x : "+_sp2.x]),
- //表示インデックス指定で追加
- //addChildAt(コンテナ、オブジェクト、インデックス)
- new AddChildAt(container, _sp1, 0),
- new Wait(.5),
- new AddChildAt(container, _sp2, 1),
- new Wait(.5),
- new AddChildAt(container, _sp3, 2),
- new Wait(.5),
- //各種パラメータのトゥイーン
- //DoTween(オブジェクト、パラメータ,効果、処理時間)
- new DoTween(_sp3, { x:60, y:60, alpha:.5, scaleX:1.5, scaleY:1.5, scaleZ:1.5, rotationX:45, rotationY:45, rotationZ:45 }, Regular.easeOut, 2),
- //Tweenerと同じ
- new DoTweener(_sp2, {x:120, y:120, alpha:1, _color_redOffset:36, time:2, transition:"easeOutElastic"}),
- //表示リストからはずす
- //RemoveChild(コンテナ、オブジェクト)
- new RemoveChild(container, _sp1),
- new Wait(.5),
- //表示リストからすべての子をはずす
- //RemoveAllChildern(コンテナ)
- new RemoveAllChildren(container),
- new Wait(1),
- new Prop(_mc1, {x:stage.stageWidth/2-_mc1.width/2, y:stage.stageWidth/2-_mc1.width/2}),
- new AddChild(container, _mc1),
- //transitionの効果がつけられる
- //DoTransition(オブジェクト、トランジションの種類、トランジションのかかりかた、処理時間、効果)
- new DoTransition(_mc1, PixelDissolve, Transition.IN, 1, Regular.easeInOut),
- new Wait(.5),
- new DoTransition(_mc1, PixelDissolve, Transition.OUT, 1, Regular.easeInOut),
- new Prop(_mc1, {alpha:0})
- );
- }
- protected override function atSceneInit():void {
- addCommand(
- //
- );
- }
- protected override function atSceneGoto():void {
- addCommand(
- //
- );
- }
- }
- class TestSprite extends CastSprite {
- public var color:uint = 0x00DDDDDD;
- public function TestSprite(initObject:Object = null) {
- super(initObject);
- if(initObject) color = uint(initObject);
- graphics.beginFill(color);
- graphics.drawRect(0, 0, 200, 200);
- graphics.endFill();
- }
- override protected function atCastAdded():void
- {
- addCommand(
- //
- );
- }
- override protected function atCastRemoved():void
- {
- addCommand(
- //
- );
- }
- }
- class TestMovieClip extends CastMovieClip {
- public var color:uint = 0x00DDDDFF;
- public function TestMovieClip(initObject:Object = null) {
- super(initObject);
- if(initObject) color = uint(initObject);
- graphics.beginFill(color);
- graphics.drawRect(0, 0, 200, 200);
- graphics.endFill();
- }
- override protected function atCastAdded():void
- {
- addCommand(
- //
- );
- }
- override protected function atCastRemoved():void
- {
- addCommand(
- //
- );
- }
- }
- class TestButton extends CastButton {
- public function TestButton( initObject:Object = null )
- {
- // 親クラスを初期化します。
- super( initObject );
- // 移動先となるシーン識別子を設定します。
- //sceneId = new SceneId( "/index/command" );
- graphics.beginFill(0x00000000);
- graphics.drawRect(-100, -35, 200, 70);
- graphics.endFill();
- }
- override protected function atCastAdded():void
- {
- addCommand(
- //new Prop(this, {x:stage.stageWidth/2,y:stage.stageHeight/2})
- )
- this.x = stage.stageWidth / 2;
- this.y = stage.stageHeight / 2;
- }
- }
Progression 4 BasicAppConfig 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 FlashTest extends Sprite {
- public var manager:Progression;
- public function FlashTest() {
- Progression.initialize( new BasicAppConfig() );
- manager = new Progression( "index", stage, IndexScene );
- //Debugger.addTarget( manager );
- manager.goto( manager.root.sceneId );
- }
- }
- }
- 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.*;
- import jp.progression.data.*;
- import jp.progression.events.*;
- import jp.progression.scenes.*;
- class IndexScene extends SceneObject {
- public function IndexScene() {
- }
- protected override function atSceneLoad():void {
- addCommand(
- "Progression 4"
- );
- }
- protected override function atSceneInit():void {
- addCommand(
- "BasicAppConfig Test"
- );
- }
- protected override function atSceneGoto():void {
- addCommand(
- );
- }
- }
Progression 4 BasicAppConfig 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 FlashTest extends Sprite {
- public var manager:Progression;
- public function FlashTest() {
- Progression.initialize( new BasicAppConfig() );
- manager = new Progression( "index", stage, IndexScene );
- Debugger.addTarget( manager );
- manager.goto( manager.root.sceneId );
- }
- }
- }
- 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.*;
- import jp.progression.data.*;
- import jp.progression.events.*;
- import jp.progression.scenes.*;
- class IndexScene extends SceneObject {
- public function IndexScene() {
- }
- protected override function atSceneLoad():void {
- addCommand(
- "Progression 4"
- );
- }
- protected override function atSceneInit():void {
- addCommand(
- "BasicAppConfig Test"
- );
- }
- protected override function atSceneGoto():void {
- addCommand(
- );
- }
- }
notice:







