YAIMO BLOG
会津の大食いFlasher!! WordPress, iPhone, Progression, FlashDevelop他
BetweenAS3 SoundManager サウンドまとめて管理asdocを書きだそうとして四苦八苦したメモ。

FlashDevelopでasdocが簡単に書き出せる機能を使いました。

5
6
普段使わない人はなかなか気にとめないですよね。。

それで、今回問題になったのは、asdocを書きだそうとした際に、BetweenAS3を一緒に書きださないためのTips

FlashDevelop3 RC3 から ASDoc を書き出すメモ

をみながらサクサクっと簡単にasdocを書き出せたのはいいのですが、

今回作成したような~依存型のクラスファイルをasdocを書きだそうとしたのだけれども、

BetweenAS3も一緒に書き出されてしまいます。

4d
BetweenAS3の文書は書き出さない方法は
  1. Project -> Exclude classes で1つ1つファイルを除外
    結果: 時間は大切にするべき

  2. Project -> Exclude classes で” * ” 使用してファイルを除外
    結果: ” * ” によるファイル指定できず。

  3. Extra optionsでAdobeの公式ページによると

    クラスの除外

    doc-classes、doc-sources、および doc-namespaces オプションによって指定されるクラスは、次の例外を除いてすべて文書化されます。

    * exclude-classes オプションを使用してクラスを指定した場合は、そのクラスは文書化されません。
    * クラスの ASDoc コメントに @private タグが含まれる場合は、そのクラスは文書化されません。
    * クラスが SWC で検出されると、そのクラスは文書化されません。

    さらに、さらに、

    コンパイル用として、SWC ファイルとして表されるライブラリファイルをアプリケーションが必要とする場合もあります。次の例では、-library-path オプションを使用して、SWC ファイルが格納されているディレクトリを指定します。
    asdoc -source-path . -doc-classes myComponents.BlueButton -library-path C:¥myLibs


    明示的にSWCファイルをコンパイルオプションに入れてやれば、文書化されないようになる!!

    -library-path を使用してswcのあるフォルダを指定してやるとこうなります。

    2
    結果:

    3

ふひひ。できた!!
SWCじゃないライブラリをフォルダでasdocの対象にならない指定ができたら便利なのに。。

Tags:
実用的(開発中のBetweenAS3 alpha を使ってる時点でアレだけど)な

BetweenAS3依存のSoundManagerを作ってみました。

内部でBetweenAS3によるSoundのフェードアウト、インを実装しています。

モチベーションは、
  1. ClockさんのQ-filmのソースを覗いていたらSoundManagerクラスがあって、
    このSound管理の仕方がすごく勉強になったこと。

  2. 今まではSoundのON/OFFのTweenはTweenerを使用していましたが、これからBetweenAS3に移行していくつもりなので、1つのプロジェクトでTween系のライブラリを2つ使用するのは、なにかスッキリしなかった。

  3. BetweenAS3がただ単に使いたかった。

  4. SingltonクラスでSoundをまとめて管理しているので、一度初期化すればどこでも使えるのでとっても簡単。
    実際のFlashでの案件のBGMやクリック音は大体1個ずつだから複数登録できなくても平気

  5. SparkProjectに参加してみたい
【主な機能】

  • BGMのON/OFFと自動ループ再生,停止位置からの途中再生,自動Tween再生

  • BGMのボリューム変更,ボリューム自動保存機能,自動Tween変更

  • ボタン音のON/OFFとミュート機能


Read the rest of the entry »


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: ,
実家から帰ってきて腕がうでがなまっていたのでHANABIの勉強をしてみました。夏ですしね。パーティクルおもしろいです!
wonderfulの注釈をみながらやってみてください。むちゃくちゃ楽しいです。




以下のエントリーがすばらすぃ。わかりやすい注釈ありがとうございます。
forked from: HANABI(初級者がコードに注釈をつけてみた)

初心者の僕にとってハチャメチャ勉強になりました。

ColorTrasnformによる色の減色はClockさんの以下のエントリーを先にみておくとわかりやすいです。
Flashで残像エフェクト (フレームアクションで簡単に)

この方がsqrt()の意味がわからないと書いていたので自分なりに補足:
Math.randam()は0(限りなく0に近い)~1の値をとりますが、
もし0.1だった場合、0.1=1/10 -> sqrt(1/10)となり、(sqrt(10)=3.16…..なので)1/3.16 = 0.316になる
同様に、1/sqrt(2) = 0.707 のように計算していくと、

0  ~    0.1     ~   0.25   ~    0.5      ~ 1
0  ~    0.316  ~  0.5     ~    0.707   ~ 1



となるので、0.3以下の値がでにくくなるんじゃないかと思われます。
こんな方法があったのか!!他の方のコードってとっても勉強になります。

今回一番面白かったのが、unlock(),とlock()でしたね。
リファレンスを見てた時、どーやって実際につかったりするのかな?なんて思ってましたが解決しました。


Tags: , , ,

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