YAIMO BLOG
会津の大食いFlasher!! WordPress, iPhone, Progression, FlashDevelop他
今更ながら、Progressionを使用して実験サイトの土台を作成してみました。
実際に案件で使う前に一度使いたかったのが大きな理由。

コンテンツなど何も今の所ないのですが、随時追加予定。


http://yaimo.net/>


今回はメモリのことはあまり考えず実装、構築してみました。
ざっくり使用した感想は、
  1. Progressionでのメモリなどのある程度幅広い知識がないと実際の案件では投入できない

    コマンドを使用したり、swfを読み込んだ際のunLoad時にメモリをうまく解放できないというのがあるそうです。
    検索すると色々な方がエントリーしているので、探してみてください。
    Progressionでガベージコレクションされないのをどうにかしようとした記録


    メモリだけではなく、swfaddressを使用したパーマリンクを実現する際にも注意が必要。
    たまに、Progressionを使用したサイトに見るのですが、Progressionのイベントフローでの処理を理解していないと、アドレスを直接入力した際、Progressionの出力エラーが表示されることがあります。

  2. 制作フローを確立すれば、デザインなどの方に時間が割けるのでより良いものが作れる

    Progressionを使用することで、同じコンテンツを作成する場合、かなり時間が短縮できると感じました。
    特に、ボタンの自動で有効/無効にしてくれるなどの機能や、シーンという概念が最初は理解しにくかったのですが、これがあることにより、とても作りやすくなりますね。

  3. 制作後の管理が容易

    オレオレプログラムより、Progressionで管理したら、引き継ぎなどをする際も簡単なのでは?
    更新する際や、コンテンツ追加の際も、prmlをうまく利用すればとても素敵!!な予感がしました。
今回作成した際に、得たものをこれから、ちょっとずつエントリーしていきます。

とりあえずProgressionデビューだ!!!!

Tags:
Progression this の扱い(破) 無名関数, Func, functionの続き。

Progressionクラスを生成し、コンストラクタで”id”を指定します。

this.id = "yaimo";
trace("クラスのid: "+this.id);
//出力:クラスのid: yaimo
trace("普通にthis: "+this);
//出力:[IndexScene sceneId="/index" id="yaimo" name="index" group="null"]


今回はSerialList.addCommand()内でのthisの扱いについて、全体のコードはこんな感じです。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var sList:SerialList = new SerialList();
			sList.id = "sList";
			sList.addCommand(
				//[		
				new Trace("SerialList.addCommand内でのthis.id: " + this.id),
				new Func(function ():void 
				{
					trace("SerialList.addCommand内でのthis" + this);
					trace("SerialList.addCommand内でのthis.parent" + this.parent);
					this.id = "Function";
					trace("SerialList.addCommand内でのthis.id: " + this.id);
				}),
				function ():void 
				{
					trace("SerialList.addCommand内でのthis.parent" + this.parent.id);
					this.parent.insertCommand(new Trace("追加1"));
					insertCommand(new Trace("追加2"));
				},
 
				[//ここからParallelList
				new Func(function ():void 
				{
					trace("SerialList.addCommand内でのthis: " + this);
					trace("SerialList.addCommand内でのthis.parent" + this.parent);
				}),
				],

全体の出力結果です。

SerialList.addCommand内でのthis.id: yaimo
 
SerialList.addCommand(コード)での実験------new Func()---------
SerialList.addCommand内でのthis[Func id="null" name="command_47" group="null"]
SerialList.addCommand内でのthis.parent[SerialList id="sList" name="command_42" group="null"]
SerialList.addCommand内でのthis.id: Function
-------------------------------------------------------------
 
SerialList.addCommand(コード)での実験-----function()----------
SerialList.addCommand内でのthis.parentsList
-------------------------------------------------------------
追加1
 
SerialList.ddCommand([コード])での実験-----new Func()----------
SerialList.addCommand内でのthis: [Func id="null" name="command_48" group="null"]
SerialList.addCommand内でのthis.parent[ParallelList id="null" name="command_54" group="null"]
-------------------------------------------------------------





基本は前回とほとんど同じなので省きます。
それで注目したいのが、10行目の

trace("SerialList.addCommand内でのthis.parent" + this.parent);

での出力が

SerialList.addCommand内でのthis.parent[SerialList id="sList" name="command_42" group="null"]

でthis.parentの参照がsListになることです。
なので、19,20行目のthis.parentでsListにinsertCommandによる挿入を行わないと思ったとおりの実行をしてくれません。
“追加1”の実行されるタイミングはfunctionのCommandが終わってから。
“追加2″はおそらく、クラスに定義されているaddCommand(){}に登録されるんじゃないかと思われます。

【まとめ】
  • new Func(function:void{}),function():void{}内でのthisはFuncクラスを指す

  • SerialList.addCommand(){}の場合、function():void{this.parent}はSerialListを指す。


Tags: , , ,
Progression this の扱い(序) 無名関数, Func, functionの続き。

Progressionクラスを生成し、コンストラクタで”id”を指定します。

this.id = "yaimo";
trace("クラスのid: "+this.id);
//出力:クラスのid: yaimo
trace("普通にthis: "+this);
//出力:[IndexScene sceneId="/index" id="yaimo" name="index" group="null"]


今回はaddCommand()内でのthisの扱いについて、全体のコードはこんな感じです。

addCommand(
				new Trace("addCommand内でのthis.id: " + this.id),
				new Func(function ():void
				{
					trace("addCommand内でのthis" + this);
					trace("addCommand内でのthis.parent" + this.parent);
					this.id = "Function";
					trace("addCommand内でのthis.id: " + this.id);
					trace("addCommand内でのthis.parent.id: " + this.parent.id);
					this.parent.id = "parentはSerialList";
					trace("addCommand内でのthis.parent" + this.parent);
				}),
				function ():void
				{
					trace("addCommand内でのthis" + this);
					trace("addCommand内でのthis.parent" + this.parent);
					this.id = "fuction";
					trace("addCommand内でのthis.id: " + this.id);
					trace("addCommand内でのthis.parent.id: "+this.parent.id);
				},
				[//ここからParallelList
				new Func(function ():void
				{
					trace("addCommand内でのthis" + this);
					trace("addCommand内でのthis.parent" + this.parent);
					this.id = "Function";
					trace("addCommand内でのthis.id: "+this.id);
					trace("addCommand内でのthis.parent.id: "+this.parent.id);
				}),
				]
			);


Read the rest of the entry »


Tags: , , ,
ProgressionのCommand時におけるthisの参照の違いと、無名関数におけるブロックスコープとthisの参照について考える。

Progressionクラスを生成し、コンストラクタで”id”を指定します。

this.id = "yaimo";
trace("クラスのid: "+this.id);
//出力:クラスのid: yaimo
trace("普通にthis: "+this);
//出力:[IndexScene sceneId="/index" id="yaimo" name="index" group="null"]

まずはじめに無名関数におけるthisの扱いから、

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
private function hoge():void
		{
			var target:MovieClip = new MovieClip();
			trace("普通の関数内でのthis.id: "+this.id);
 
			target.addEventListener(MouseEvent.MOUSE_OUT,function ():void
			{
				trace("無名関数内でのtarget: "+target);
				trace("単純にthis: " + this);
				trace("ではthis.parent: " + this.parent);
				trace("無名関数内でのthis.id: " + this.id);
				trace("無名関数内でのthis.target: " + this.target);
				this.id = "this.idは無名関数内のidとして登録されています。";
				trace("登録後のthis: "+this.id);
			});


Read the rest of the entry »


Tags: ,
Progression URLObject ってデータベースのやりとりに便利?な予感。AIRとか。
その他にもURL指定してあげれば

url.navigateTo("_blank");

navigateToURLみたいに使えます。


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package {
    import flash.display.Sprite;
    import jp.nium.net.*;
    import flash.text.*;
    import jp.nium.external.*;
 
 
    public class FlashTest extends Sprite {
        private var textList:Array =[];
 
        public function FlashTest() {
 
            var url:URLObject = new URLObject("http://asdoc.progression.jp/test.swf");
            var url2:URLObject = new URLObject("http://localhost:8081/yaimo");
 
            url.password = "password";
            url.user = "me";
            textinit();
 
            textList[0].text = url.toString();
            textList[1].text = url.host;
            textList[2].text = url.password;
            textList[3].text = url.url;
            textList[4].text = url.fileExtension;
            textList[5].text = ""+URLObject.validate("URLOBjectととはなんぞや");
            textList[6].text = url.fileName;
            textList[7].text = url2.port;
            textList[8].text = url.user;
 
            //URLRequestでかえってくるのでとりあえずURLはURLObjectに入れとけば管理しやすいとか?
            textList[9].text = url.toURLRequest();
 
            //Flash Player のコンテナを含むアプリケーション(通常はブラウザ)でウィンドウを開くか、置き換えます。
            //コメントをはずすと指定URLに飛びます。
            //user設定してあるとuserでログインしたりもできる。
            //url.navigateTo("_blank");
 
            //あとはデータベースと連動するときに役に立ちそうな予感(AIRとか)
            //指定URLに飛んだりするのが便利だった!!
 
        }
        public function textinit():void{
            for(var i:int = 0; i<10;i++){
                var text:TextField = new TextField();
                text.width = 300;
                text.y = i*20;
                addChild(text);
                textList.push(text);
                }
            }
    }
}


Tags:
Progressionのindex.asでSWF Profilerを以下のように書き込んで使ってやるとうまくいかなかったのでどうにかならないかやってみた。

SWFProfiler.init(stage, this);


原因はおそらく
  1. Progressionのオブジェクトが右クリックの対象の場合、Progressionの自分で作ったコンテキストメニューにうまく追加ができない(自分の力不足)
  2. SWFProfiler.init(stage, this);のthisでのProgressionオブジェクトの登録がよろしくない。
  3. コンテキストメニューを登録したProgression以外のオブジェクトより上にProgressionオブジェクトの設置

Read the rest of the entry »


Tags: , , ,

Powered by Wordpress
Theme © 2005 - 2009 FrederikM.de
BlueMod is a modification of the blueblog_DE Theme by Oliver Wunder