<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>mrhdms &#187; Flash</title>
	<atom:link href="http://mrhdms.iixx.jp/category/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://mrhdms.iixx.jp</link>
	<description>flashとかcss/htmlとかweb制作に関するメモ</description>
	<lastBuildDate>Wed, 11 Jan 2012 15:12:32 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://mrhdms.iixx.jp/category/flash/feed/" />
		<item>
		<title>FlashDevelop4でFlashPlayer11とかAIR3書き出ししてハマったところだけ</title>
		<link>http://mrhdms.iixx.jp/2011/11/02/flashdevelop4_flashplayer11_air3/</link>
		<comments>http://mrhdms.iixx.jp/2011/11/02/flashdevelop4_flashplayer11_air3/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 14:13:42 +0000</pubDate>
		<dc:creator>mrhdms</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[AIR3]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[FlashDevelop]]></category>

		<guid isPermaLink="false">http://mrhdms.iixx.jp/?p=170</guid>
		<description><![CDATA[はい。いとも簡単に躓く僕です。 また忘れそうなんでメモっとく。 まず、基本的な手順はすべて完結かつ丁寧にこちらで説明されています。 NUTSU » Build FlashPlayer 11 AS with FlashDe [...]]]></description>
			<content:encoded><![CDATA[				<p>はい。いとも簡単に躓く僕です。<br />
				また忘れそうなんでメモっとく。</p>
				<p>まず、基本的な手順はすべて完結かつ丁寧にこちらで説明されています。<br />
				<a href="http://nutsu.com/blog/2011/fd4_fp11.html">NUTSU » Build FlashPlayer 11 AS with FlashDevelop</a></p>
				<p>FlashPlayer11書き出しについてはとくに問題なくいけました。<br />
				AIR3書き出しで2点ほどハマった箇所がありました。</p>
				<h3>descriptor version does not match runtime version とかめっちゃ言う</h3>
				<p>まあ言葉の通りバージョン食い違ってますよってことらしいけど、<br />
				AIRランタイム更新しなおしたりSDK入れなおしたり書き出し設定みなおしても、うんともすんとも・・</p>
				<p>で、結局は、ブロジェクトのbatディレクトリに生成されている <strong>SetUpSDK.bat</strong> 内で指定されているSDKパスが違ってました。<br />
				FlashDevelopで設定されているデフォルトのパスが入ってるんですねえ。それのバージョン古かったというオチでした。</p>
				<pre class="brush: plain; title: ; notranslate">
set FLEX_SDE=C:\hogehoge\fugafuga\flex_sdk_4.5.1
</pre>
				<p>こんな。</p>
				<h3>MacのParallels環境だと面倒？</h3>
				<blockquote><p>2011/11/8 追記<br />
				プロジェクト新規作成時にちゃんとネットワークドライブ（Z:¥ みたいなの）でプロジェクトのパスを指定してやっていれば問題なかったです。。すいません。フィリップさん濡れ衣ごめんなさい。<br />
				新規作成時に(¥¥psf¥home~~~)みたいなネットワークのパスで作っちゃってたみたいです。<br />
				作ってしまったあと、あとから変える場合は、obj/プロジェクト名＋Config.xmlのファイル内をいじればOKかと。</p></blockquote>
				<p><del datetime="2011-11-08T11:40:52+00:00">普段が、MacのParallels上でFlashDevelopを動かしてるので、この環境でさくっと行きたかったけど・・・結果的にはダメでした。</del></p>
				<p><del datetime="2011-11-08T11:40:52+00:00">コマンドプロンプトが立ち上がる際に、ネットワーク共有ディレクトリ上で起動すると現在のディレクトリを引き継げないとか。<br />
				（普通Macと行き来するから仮想の共有ディレクトリで作業してます！）<br />
				で、解決のためにドライブを割り当てなさいってことなんだけども、Parallels上ではすでにその様に設定されていて、（Z:¥ みたいな）それでもFlashDevelopからcmd.exeが立ち上がるときはそういう設定は反映されないと。</del></p>
				<p><del datetime="2011-11-08T11:40:52+00:00">解決策としては、.batファイル内で指定してる　bat/**.bat みたいな相対パスな指定をすべて絶対パスに変えてやれば動くんじゃないかと思うけど、「そこまでするならおとなしくFlash Builder使うわ。」という結論にいたって試してません。<br />
				（いや、全然簡単にできるし！みたいな、詳しい方いたら是非やさしくおしえてください。）</del><br />
				<del datetime="2011-11-08T11:40:52+00:00"><br />
				FlashDevelopの<a href="http://www.flashdevelop.org/community/viewtopic.php?f=9&#038;t=3529">Bridge</a>ってのが現在進行中で進んでるけど、Parallelsはまだ使えないっぽいので、このへんが解決につながるのかなーとかふんわり期待してます。</del></p>
				<p>以上、取り留めもなく。27最後のメモ。</p>
]]></content:encoded>
			<wfw:commentRss>http://mrhdms.iixx.jp/2011/11/02/flashdevelop4_flashplayer11_air3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://mrhdms.iixx.jp/2011/11/02/flashdevelop4_flashplayer11_air3/" />
	</item>
		<item>
		<title>FlashDevelop4でProgression4のリリースビルド書き出し用マクロが動かない時の暫定版</title>
		<link>http://mrhdms.iixx.jp/2011/10/28/flashdevelop4_progression4_releasebuild_macro/</link>
		<comments>http://mrhdms.iixx.jp/2011/10/28/flashdevelop4_progression4_releasebuild_macro/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 10:49:45 +0000</pubDate>
		<dc:creator>mrhdms</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[FlashDevelop]]></category>
		<category><![CDATA[macro]]></category>
		<category><![CDATA[Progression4]]></category>

		<guid isPermaLink="false">http://mrhdms.iixx.jp/?p=164</guid>
		<description><![CDATA[FD4にしたときにわりと最初にぶつかった壁で、 暫定マクロファイル作って様子見・・してたら一度紛失してしょんぼりしたので 晒しておきます。 ちなみにC#はもちろんFlashDevelopのAPIをあまり理解せずにノリで書 [...]]]></description>
			<content:encoded><![CDATA[				<p>FD4にしたときにわりと最初にぶつかった壁で、<br />
				暫定マクロファイル作って様子見・・してたら一度紛失してしょんぼりしたので<br />
				晒しておきます。</p>
				<p>ちなみにC#はもちろんFlashDevelopのAPIをあまり理解せずにノリで書いているので不完全な箇所あるかと思います。<br />
				標準的な環境では動作確認できています。<br />
				<span id="more-164"></span><br />
				<script src="https://gist.github.com/1322030.js"> </script></p>
]]></content:encoded>
			<wfw:commentRss>http://mrhdms.iixx.jp/2011/10/28/flashdevelop4_progression4_releasebuild_macro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://mrhdms.iixx.jp/2011/10/28/flashdevelop4_progression4_releasebuild_macro/" />
	</item>
		<item>
		<title>「FizzBuzzではじめるテスト」を AS3 と FlexUnit4 ではじめるテスト</title>
		<link>http://mrhdms.iixx.jp/2011/07/27/fizzbuzz-test-actionscript3-flexunit4/</link>
		<comments>http://mrhdms.iixx.jp/2011/07/27/fizzbuzz-test-actionscript3-flexunit4/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 23:13:12 +0000</pubDate>
		<dc:creator>mrhdms</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[イベント]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[FlashDevelop]]></category>
		<category><![CDATA[flexunit]]></category>
		<category><![CDATA[kphpug]]></category>

		<guid isPermaLink="false">http://mrhdms.iixx.jp/?p=155</guid>
		<description><![CDATA[先日、第１回関西PHP勉強会という勉強会に参加してきました。 テーマは「テスト」、TDD（テスト駆動開発）とか言う、僕には縁のなかったあれです。 ただ、わりと入門編ということで敷居の低いセッションも用意してくれていたので [...]]]></description>
			<content:encoded><![CDATA[				<p>先日、<a title="第１回関西PHP勉強会" href="http://atnd.org/events/17549">第１回関西PHP勉強会</a>という勉強会に参加してきました。<br />
				テーマは「テスト」、TDD（テスト駆動開発）とか言う、僕には縁のなかったあれです。<br />
				ただ、わりと入門編ということで敷居の低いセッションも用意してくれていたので、<br />
				ActionScriptでテスト入門してみました。<br />
				<span id="more-155"></span></p>
				<h2>TDDとかしらんがな</h2>
				<p>テストってなんぞ？っていう状態だったので、とりあえずこのへんの動画をみて、<br />
				テスト駆動開発の雰囲気をつかんで、話を聞いたようなそんなレベルです。<br />
				最後の方はリファクタリングの話にも触れられてるので、そのへんも勉強になります。</p>
				<p><a href="http://www.nicovideo.jp/mylist/4805036">和田卓人の“テスト駆動開発”講座</a></p>
				<p>と、まあ、急がば回れ的な雰囲気で、何やらよさそうです。</p>
				<p>今回参考にさせてもらったのは、「<a href="http://www.1x1.jp/blog/2011/07/event_kansai_php_1_fizzbuzz_test.html">FizzBuzzではじめるテスト – 第１回関西PHP勉強会</a>」<br />
				こちらの内容で、そのままASに持ってきて試してます。</p>
				<h2>FizzBuzzもしらんがな</h2>
				<p>なにやらエンジニア界隈ではわりと常識らしい「FizzBuzz」、初めて聞きました。<br />
				参考のエントリできちんと説明されていますが、1から順に数字を出力していき、<br />
				3の倍数で&#8221;Fizz&#8221;、5の倍数で&#8221;Buzz&#8221;、公倍数で&#8221;FizzBuzz&#8221;と、<br />
				要は世界のナベアツ的な出力をするプログラムを指すらしいです。</p>
				<p>ASで書くとこんな感じ。（サンプルのまんまですけどね。）</p>
				<pre class="brush: as3; title: ; notranslate">
package
{
	/**
	 * FizzBuzzクラス
	 * @author Hidemasa Mori
	 */
	public class FizzBuzz
	{
		/**
		 * FizzBuzz テキスト表現を作成
		 *
		 * @param uint num
		 * @return String
		 */
		public static function makeFizzBuzz(num:uint):String
		{
			if (num % 3 == 0 &amp;&amp; num % 5 == 0)
			{
				return &quot;FizzBuzz&quot;;
			} else if (num % 3 == 0) {
				return &quot;Fizz&quot;;
			} else if ( num % 5 == 0) {
				return &quot;Buzz&quot;;
			} else {
				return num.toString();
			}
		}

	}

}
</pre>
				<h2>FlexUnit4+FlashDevelopでテスト</h2>
				<p>で、本題のテストですが、今回はAS3+FlexUnit4（4.1Betaが出てたけどうまく行かず）+FlashDevelop4でやってます。<br />
				プロジェクトごとGithubに置いてるので、そのままmxmlをドキュメントクラスにしてコンパイルすると動くかと。<br />
				サンプルの作成に「<a href="http://d.hatena.ne.jp/ActionScript/20091121/fd_flex_unit_4_test">FlashDevelopの使い方 (17)FlexUnit 4でユニットテストをする方法</a>」を大変参考にさせていただきました。</p>
				<p><a title="AS3-FizzBuzzTest-FlexUnit4" href="https://github.com/mrhdms/AS3-FizzBuzzTest-FlexUnit4">サンプルファイル</a></p>
				<p>手順としては、<a href="http://www.flexunit.org/?page_id=14">FlexUnit4をダウンロード</a>して、swcファイルをライブラリに追加していきます。<br />
				今回のサンプルはこんなファイル構成。<br />
				<a href="http://www.flickr.com/photos/65670447@N03/5979307014/" title="FizzBuzzTest - FlashDevelop" rel="" class="flickr-image"><img src="http://farm7.static.flickr.com/6126/5979307014_e6b9dec958.jpg" alt="FizzBuzzTest - FlashDevelop" class="" title="" longdesc="" /></a></p>
				<p>サンプルに入れているMain.asをドキュメントクラスにしても動くけど、<br />
				GUIを表示させることができなかった（traceはできる）ので、mxmlでのコンパイルに落ち着きました。</p>
				<p>テストコードはこんな感じ。<br />
				[test]とメタタグを書いたメソッドがテスト用メソッドとなるようです。<br />
				ほかにも、testの前後に処理を行うbeforeやafter、非同期処理に対応したメタタグなど色々あるみたいです。</p>
				<pre class="brush: as3; title: ; notranslate">
package
{
	import org.flexunit.Assert;
	/**
	 * FizzBuzzのテストクラス
	 * @author Hidemasa Mori
	 */
	public class FizzBuzzTest
	{
		[Test]
		public function testFizzBuzz():void
		{
			Assert.assertEquals(&quot;Fizz&quot;, FizzBuzz.makeFizzBuzz(3));
		}

		[Test]
		public function testFizzBuzz2():void
		{
			Assert.assertEquals(&quot;Buzz&quot;, FizzBuzz.makeFizzBuzz(5));
		}

		[Test]
		public function testFizzBuzz3():void
		{
			Assert.assertEquals(&quot;FizzBuzz&quot;, FizzBuzz.makeFizzBuzz(15));
		}

	}

}
</pre>
				<p>Assert.assertEqualsの引数を比べて、同じなら、テストが通りグリーンの表示</p>
				<a href="http://www.flickr.com/photos/65670447@N03/5978749215/" title="Adobe Flash Player 10" rel="flickr-mgr" class="flickr-image"><img src="http://farm7.static.flickr.com/6138/5978749215_6455d28e13_z.jpg" alt="Adobe Flash Player 10" class="flickr-large" title="" longdesc="" /></a>
				<p>違う結果が帰ってきた場合はレッドの表示となります。</p>
				<a href="http://www.flickr.com/photos/65670447@N03/5979307216/" title="Adobe Flash Player 10-1" rel="flickr-mgr" class="flickr-image"><img src="http://farm7.static.flickr.com/6141/5979307216_a00d537e3e_z.jpg" alt="Adobe Flash Player 10-1" class="flickr-large" title="" longdesc="" /></a>
				<p>とりあえず、赤と緑がみれたので満足。</p>
				<h2>他言語みたいなサクサクテストな環境は・・</h2>
				<p>今回の方法だと参考エントリでも言及されてるように、<br />
				GUIで確認するとなるとパブリッシュ→ムービープレビューの流れが必要になり、<br />
				手順としては冗長に感じますね・・こまめにテストするには敷居が高いです。<br />
				レッド/グリーンをGUIで確認しつつ、リアルタイムにテストを実行できる環境があればいーなー。<br />
				（勉強会でデモされてた、MakeGoodみたいな感じで）<br />
				FlashBuilderはこのあたり、連携スムーズになってるんでしょうか。興味湧いてきました。</p>
				<h2>UIのテスト</h2>
				<p>あと、Selenium IDEというのが紹介されていて、とってもいいなーと感じました。<br />
				ブラウザベースでの自動テストができるのは魅力的ですし、<br />
				デザイナーにも役立ちそうなツールなので是非試してみたいです。</p>
				<p>また、FlashのUI自動テストについても調べてみたら、<br />
				FlexMonkey とか QTP とかってのがあるみたいです。<br />
				そのへんはまた今度。</p>
]]></content:encoded>
			<wfw:commentRss>http://mrhdms.iixx.jp/2011/07/27/fizzbuzz-test-actionscript3-flexunit4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://mrhdms.iixx.jp/2011/07/27/fizzbuzz-test-actionscript3-flexunit4/" />
	</item>
		<item>
		<title>FlashDevelop4でDebugger startup errorが出たときの対応方法</title>
		<link>http://mrhdms.iixx.jp/2011/07/12/fd4_debugger_error/</link>
		<comments>http://mrhdms.iixx.jp/2011/07/12/fd4_debugger_error/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 12:15:26 +0000</pubDate>
		<dc:creator>mrhdms</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[FlashDevelop]]></category>

		<guid isPermaLink="false">http://mrhdms.iixx.jp/?p=151</guid>
		<description><![CDATA[FD4にしてからタイトルのエラーが出てて、パブリッシュはできるので数日無視してたけど、 気持ち悪いのでそろそろ直しました。 本家のフォーラムで同じ質問にフィリップさんも答えてくれてたので、英語が苦じゃない方はこちらを参照 [...]]]></description>
			<content:encoded><![CDATA[				<p>FD4にしてからタイトルのエラーが出てて、パブリッシュはできるので数日無視してたけど、<br />
				気持ち悪いのでそろそろ直しました。</p>
				<p>本家のフォーラムで同じ質問にフィリップさんも答えてくれてたので、英語が苦じゃない方はこちらを参照<br />
				<a href="http://www.flashdevelop.org/community/viewtopic.php?f=6&amp;t=8374">http://www.flashdevelop.org/community/viewtopic.php?f=6&amp;t=8374</a></p>
				<p>以下対応方法<br />
				<span id="more-151"></span></p>
				<ol>
				<li>Windows\System32 ディレクトリに &#8216;msvcr71.dll&#8217; があるか確認する。</li>
				<li>ない場合は Java\jdk1.6.0_20\jre\bin から dll ファイルをコピーして上記ディレクトリに移す。<br />
				（僕の場合は C:\Program Files\Java\jre6\bin にありました。）</li>
				<li>FDを再起動する。</li>
				</ol>
				<p>これだけ。</p>
]]></content:encoded>
			<wfw:commentRss>http://mrhdms.iixx.jp/2011/07/12/fd4_debugger_error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://mrhdms.iixx.jp/2011/07/12/fd4_debugger_error/" />
	</item>
		<item>
		<title>Flashとブラウザのスクロールバーが一緒に動く[未解決]</title>
		<link>http://mrhdms.iixx.jp/2011/04/06/scrollbar_jsfix/</link>
		<comments>http://mrhdms.iixx.jp/2011/04/06/scrollbar_jsfix/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 18:27:29 +0000</pubDate>
		<dc:creator>mrhdms</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[externalInterface]]></category>
		<category><![CDATA[SWFWheel]]></category>
		<category><![CDATA[スクロール]]></category>

		<guid isPermaLink="false">http://mrhdms.iixx.jp/?p=137</guid>
		<description><![CDATA[全画面じゃないFlashコンテンツが埋め込まれたページで、 Flashコンテンツ内にもスクロールバーがあって、ブラウザもスクロール可能な状態の時、 両方同時にスクロールしてしまう・・と。 Flashコンテンツ内のスクロー [...]]]></description>
			<content:encoded><![CDATA[				<p>全画面じゃないFlashコンテンツが埋め込まれたページで、<br />
				Flashコンテンツ内にもスクロールバーがあって、ブラウザもスクロール可能な状態の時、<br />
				両方同時にスクロールしてしまう・・と。<br />
				Flashコンテンツ内のスクロールをしてるときは、ブラウザ側は動かず、<br />
				そうでないときはブラウザだけちゃんとスクロールしてほしいんだよと。</p>
				<p>結局JavaScriptを使って解決した・・と思ったけどブラウザ依存でだめぽい。</p>
				<p><a href="http://www.fxug.net/modules/xhnewbb/viewtopic.php?topic_id=885">http://www.fxug.net/modules/xhnewbb/viewtopic.php?topic_id=885</a></p>
				<p>とりあえずこちらを参考に下記のように。<br />
				<span id="more-137"></span><br />
				AS側からはExternalInterfaceでフラグを渡しつつJSを叩く。</p>
				<pre class="brush: as3; title: ; notranslate">
public static function wheelEnabled(flg:Boolean):void
{
	if (ExternalInterface.available)
	{
		try {
			ExternalInterface.call(&quot;wheelEnabled&quot;, flg);
		} catch (error:SecurityError) {
			trace(&quot;SecurityError: &quot; + error.message);
		} catch (error:Error) {
			trace(&quot;Error: &quot; + error.message);
		}
	} else {
		trace(&quot;External interface is not available&quot;);
	}
}</pre>
				<p>JS側では渡されたフラグをもとにホイールイベントをコントロールする。</p>
				<pre class="brush: jscript; title: ; notranslate">
//ブラウザのホイールの状態（初期値有効）
var _wheelEnabled = true;

//Flashから呼ばれる関数
function wheelEnabled(flg){
  _wheelEnabled = flg;
}

//ホイールイベントの処理
function wheel(event){
  if(!_wheelEnabled){
    if(!event){
      event = window.event;
    }
    if(event.preventDefault){
      event.preventDefault();
    }
    event.returnValue = false;
  }
}

//イベントリスナーの登録
if(window.addEventListener){
  window.addEventListener('DOMMouseScroll', wheel, false);
}
window.onmousewheel = document.onmousewheel = wheel;
</pre>
				<p>WIN IE,Chrome,Firefox &#038; Mac Safari ではちゃんと動いた。<br />
				WIN Safari &#038; Mac Chrome,Firefox で期待通り動かず。</p>
				<p>がっつりお世話になってるSWFWheel自体がExternalInterfaceを使ってJSでコントロールしてるっぽいので、<br />
				こうイベント止めちゃうとダメなんだろうなあとぼんやりした思考の中で今日はギブアップ。</p>
]]></content:encoded>
			<wfw:commentRss>http://mrhdms.iixx.jp/2011/04/06/scrollbar_jsfix/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://mrhdms.iixx.jp/2011/04/06/scrollbar_jsfix/" />
	</item>
		<item>
		<title>Progression4で外部swf読み込んで、Resource上手に使えるかな？</title>
		<link>http://mrhdms.iixx.jp/2010/10/27/progression4_swf_resourse_check/</link>
		<comments>http://mrhdms.iixx.jp/2010/10/27/progression4_swf_resourse_check/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 16:55:35 +0000</pubDate>
		<dc:creator>mrhdms</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Progression4]]></category>

		<guid isPermaLink="false">http://mrhdms.iixx.jp/?p=115</guid>
		<description><![CDATA[ベースとなるswfはProgressionで用意して、各シーンの内容は外部swfでやるっていうあれです。 とくに目新しくないけど負けずに行きます。 本来ならSceneLoader使うのがスムーズだと思うけど、 Progr [...]]]></description>
			<content:encoded><![CDATA[				<p>ベースとなるswfはProgressionで用意して、各シーンの内容は外部swfでやるっていうあれです。<br />
				とくに目新しくないけど負けずに行きます。</p>
				<p>本来ならSceneLoader使うのがスムーズだと思うけど、<br />
				Progression自体の学習コストもあるので、複数人で作業する際に、<br />
				他のメンバーにそのコストをかけない方法ということで外部swfはなんでも来いな状態で。</p>
				<h2>やりたい事</h2>
				<p>・外部swf読み込む<br />
				・読み込み完了したらLoaderを配置する<br />
				・読み込み中はプログレスバー表示<br />
				・キャッシュされてる場合はプログレスバーの下りとばす<br />
				・バックグラウンドでswfキャッシュさせとく（これ別の話ですね。ResourcePrefetcher使うとサクっとできる）<br />
				<span id="more-115"></span></p>
				<h2>ハマったのはキャッシュされてる場合のResourceからLoaderへの渡しかた</h2>
				<p>各シーンで読み込まれるPageSwfクラス（CastSpriteを継承）を作って、<br />
				そのクラスのatCastAddedあたりでこんな感じで呼び出す。<br />
				（※ _swfUrl = 外部swfへのパス文字列、_loader = CastLoaderクラスのインスタンス）</p>
				<pre class="brush: as3; title: ; notranslate">
if (!getResourceById(_swfUrl))
{
	//まだ読み込んでいない場合
	addCommand(
		//プログレスバー出すなど・・省略
		new LoadSWF(new URLRequest(_swfUrl), _loader, {
			onStart		:function():void {
				//読み込みスタート時の処理　プログレスバー動かしたり
				);
			},
			onProgress	:function():void {
				//読み込み中の処理　読み込み状況取得したり

			},
			onComplete	:function():void {
				//読み込み終了時の処理
			}
		}),
		//プログレスバー消すなど・・省略
	)
} else {
	//リソースからバイト配列を取得して、_loaderに流しこむ。
	_loader.loadBytes(getResourceById(_swfUrl).toByteArray());
}

addCommand(
	new Prop(this, { alpha:0 } ),
	new AddChild(this, _loader),
	new DoTweener(this, { alpha:1, time:0.5 } )
);
</pre>
				<p>最初はResourceから取り出したデータが[Object CastLoader]とトレースされたので、<br />
				そのまま代入しようとしたり、loaderInfo.bytes を参照しようとして怒られてました。<br />
				このあたりの理解が浅いんですね〜・・<br />
				最終的には toByteArray() という素敵メソッドがすでにあったので、<br />
				Loaderにバイト配列を渡して一件落着でした。<br />
				そんなやり方してたらあかんよ！とかツッコミ絶賛募集中です。</p>
]]></content:encoded>
			<wfw:commentRss>http://mrhdms.iixx.jp/2010/10/27/progression4_swf_resourse_check/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://mrhdms.iixx.jp/2010/10/27/progression4_swf_resourse_check/" />
	</item>
		<item>
		<title>大阪ひよこの会 第2回勉強会に行ってきました。</title>
		<link>http://mrhdms.iixx.jp/2010/10/04/osakahiyoko_vol_2/</link>
		<comments>http://mrhdms.iixx.jp/2010/10/04/osakahiyoko_vol_2/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 14:43:25 +0000</pubDate>
		<dc:creator>mrhdms</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[イベント]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[hiyoko]]></category>

		<guid isPermaLink="false">http://mrhdms.iixx.jp/?p=105</guid>
		<description><![CDATA[大阪ひよこの会、第２回勉強会にいってきましたよー。 Twitterでひよこひよこ言うてたら、やたらつっこまれました。 いかがわしいもんちゃいますよ、勉強会ですよ。っていう。 概要とレポートはすばらしいまとめページが存在し [...]]]></description>
			<content:encoded><![CDATA[				<p>大阪ひよこの会、第２回勉強会にいってきましたよー。<br />
				Twitterでひよこひよこ言うてたら、やたらつっこまれました。<br />
				いかがわしいもんちゃいますよ、勉強会ですよ。っていう。</p>
				<p>概要とレポートはすばらしいまとめページが存在しますので、下記から。<br />
				<a href="http://www.project-nya.jp/modules/weblog/details.php?blog_id=1247">にゃあプロジェクト &#8211; ウェブログ &#8211; 大阪ひよこの会 (第2回勉強会) レポート</a></p>
				<p>ですんで、僕は自分のネタがらみのところを中心にレポートしたいと思います。<br />
				<span id="more-105"></span>普段の実案件でやるやり方として、<br />
				とりあえずざっくり素材を当て込んで機能を実装してから、<br />
				最後に（時間がゆるせば）味付けするような作り方をしています。</p>
				<p>ので、マイボタンクラスを晒すことにしましたん。<br />
				（本当はなにも新しいものが思いつかなかったんですごめんなさいごめんなさい）</p>
				<p><object style="width: 667px; height: 471px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="667" height="471" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://mrhdms.iixx.jp/wp/wp-content/uploads/2010/10/Buttons.swf" /><embed style="width: 667px; height: 471px;" type="application/x-shockwave-flash" width="667" height="471" src="http://mrhdms.iixx.jp/wp/wp-content/uploads/2010/10/Buttons.swf"></embed></object></p>
				<p>こんな感じで乗っかるテキストやら塗りの色を動的に変えつつ、<br />
				基本のトゥイーンだったりマウスイベントは持ってくれてるようなやつです。<br />
				ボタンのクラスは下記のような感じで、メインのASではそれを new して並べてるだけです。<br />
				※自身にaddChildしてるDynamicButtonクラスはグラフィック素材で、角丸塗りのMC（name = base）とその上のレイヤーにダイナミックなテキストフィールド（name = txt）を持っている。</p>
				<pre class="brush: as3; title: ; notranslate">
package Hiyoko
{
	import caurina.transitions.Tweener;
	import caurina.transitions.properties.ColorShortcuts;
	import flash.display.Graphics;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.ColorTransform;
	import flash.geom.Transform;
	import ui.DynamicButton;

	ColorShortcuts.init();

	/**
	 * ...
	 * @author hidemasa mori
	 */
	public class BasicButton extends Sprite
	{
		private var _btn:DynamicButton;

		public function BasicButton(buttonTxt:String,color:uint)
		{
			_btn = new DynamicButton();
			_btn.txt.text = buttonTxt;
			_btn.txt.mouseEnabled = false;
			_btn.txt.textColor = 0xFFFFFF;
			buttonMode = true;
			alpha = 0;

			setColor(color);
			addChild(_btn);

			addEventListener(MouseEvent.CLICK,clickHandler);
			addEventListener(MouseEvent.ROLL_OVER,overHandler);
			addEventListener(MouseEvent.ROLL_OUT, outHandler);
			addEventListener(Event.ADDED_TO_STAGE, addHandler);
			addEventListener(Event.REMOVED_FROM_STAGE, removeHandler);
		}

		/**
		 * ステージに追加されたときのイベントハンドラ
		 * @param	e
		 */
		private function addHandler(e:Event):void
		{
			removeEventListener(Event.ADDED_TO_STAGE, addHandler);
			Tweener.addTween(this, { alpha:1,time:0.5} );
		}

		/**
		 * ステージから削除されたときのイベントハンドラ
		 * @param	e
		 */
		private function removeHandler(e:Event):void
		{
			removeEventListener(Event.REMOVED_FROM_STAGE, removeHandler);
			Tweener.addTween(this, { alpha:0,time:0.5} );
		}

		/**
		 * マウスオーバーイベントハンドラ
		 * @param	e
		 */
		private function overHandler(e:MouseEvent):void
		{
			Tweener.addTween(this, { _tintBrightness:0.5, time:1 } );
		}

		/**
		 * マウスアウトイベントハンドラ
		 * @param	e
		 */
		private function outHandler(e:MouseEvent):void
		{
			Tweener.addTween(this, { _tintBrightness:0, time:1 } );
		}

		/**
		 * マウスクリックイベントハンドラ
		 * @param	e
		 */
		private function clickHandler(e:MouseEvent):void
		{

			removeEventListener(MouseEvent.ROLL_OVER,overHandler);
			removeEventListener(MouseEvent.ROLL_OUT, outHandler);
			//dispatchEvent(new MouseEvent(e.type));
			Tweener.addTween(this, { alpha:0, time:0.5, onComplete:function():void
			{
				this.visible = false;
			}
			} );
		}

		/**
		 * コンストラクタで指定された色をセットする。
		 * @param	color uint 変更する色
		 */
		private function setColor(color:uint):void
		{
			var tf:Transform = _btn.base.transform;
			var ctf:ColorTransform = tf.colorTransform;
			ctf.color = color;
			tf.colorTransform = ctf;
		}

	}

}
</pre>
				<p>こんなクラス。何のネタにもならんかと思ってたけど意外と話題はあるもので。<br />
				いくつか出たのでまとめます。</p>
				<h2>イベントリスナー書くとこ</h2>
				<p>あまりなんの疑問も持たずにコンストラクタに書いてたけど、<br />
				ロールオーバーでロールオーバーイベントをリムーブ、クリックイベントをadd・・・みたいに、<br />
				動的にリスナー登録していくような試みもあるみたい。<br />
				今回のシンプルなボタンならコンストラクタで一括登録しちゃうのがコストパフォーマンス的に良いとのこと。</p>
				<h2>Tweenerの罠</h2>
				<p>これもろくに意識せずにやってて、<a href="http://twitter.com/ProjectNya">@ProjectNya</a>さんに指摘してもらって、恥ずかしい限りだったわけですが、<br />
				ロールオーバー＆アウトなんかで、初期状態に戻るアニメーションの時に<br />
				１秒かけて１進み、１秒かけて１戻ればいいけど、<br />
				0.5秒で0.5進んだ場合、1秒かけて0.5をもどることになるとのこと。<br />
				こいつは普段TweenerやらBetweenAS3使ってるものとしてはきちんと理解しとかないと・・・<br />
				また検証したいと思います。</p>
				<h2>素材をボタンクラスの子にするか、素材のスーパークラスにしてまうのか</h2>
				<p>結構、よく悩むネタだったので一緒に質問させてもらいました。<br />
				このサンプルではグラフィック素材をnewして、addChildすることで自身の子としてコントロールしてます。<br />
				その素材はswc書き出ししたものを使ってるので一度パブリッシュしています。<br />
				そのときにクラス書き出し設定と一緒にスーパークラスを設定できるので、予めASを書いておいて、<br />
				素材に継承してもらうっていうやり方ですね。<br />
				これもケースバイケースかとは思いますが、<a href="http://twitter.com/masamunet">@masamunet </a>さんいわく、同じ悩みに直面した結果、今は素材として呼び出して子として扱う場面が多いとか。参考になりました。</p>
				<h2>酒と肉と夜景とFlash</h2>
				<p>今回の懇親会がめちゃいい感じの屋内バーベキュー？屋さんで<br />
				カップルで窓辺に向かって肉やきながらキャッキャウフフできるようなところに<br />
				Web好きなボーイズ＆ガールズがなだれ込むという素敵な光景でした。<br />
				みなさんの熱い（変態的な？）志を聞くだけでもモチベーションあがりますよね。<br />
				勉強会とかちょっと・・って人は懇親会だけでも参加するとおもしろいと思うよ！いろんな話聴けちゃうよ！</p>
]]></content:encoded>
			<wfw:commentRss>http://mrhdms.iixx.jp/2010/10/04/osakahiyoko_vol_2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://mrhdms.iixx.jp/2010/10/04/osakahiyoko_vol_2/" />
	</item>
		<item>
		<title>Progression4 で 外部swf のクラス（シンボル）にアクセスする</title>
		<link>http://mrhdms.iixx.jp/2010/03/15/progression4-loadswf-getdefinition/</link>
		<comments>http://mrhdms.iixx.jp/2010/03/15/progression4-loadswf-getdefinition/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 16:30:31 +0000</pubDate>
		<dc:creator>mrhdms</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Progression]]></category>
		<category><![CDATA[Progression4]]></category>

		<guid isPermaLink="false">http://mrhdms.iixx.jp/?p=84</guid>
		<description><![CDATA[やっぱ素材たっぷりになってきたしパブリッシュ軽くしたい・・とか、 素材ガンガン差し替わっちゃうよ、みたいなときってシンボルだって外部化したいですよね。 で、Progression4だとどうすんのかなーってところで、 ちょ [...]]]></description>
			<content:encoded><![CDATA[				<p>やっぱ素材たっぷりになってきたしパブリッシュ軽くしたい・・とか、<br />
				素材ガンガン差し替わっちゃうよ、みたいなときってシンボルだって外部化したいですよね。</p>
				<p>で、Progression4だとどうすんのかなーってところで、<br />
				ちょこちょこサンプルはあったけど、最小構成のサンプルということで。<span id="more-84"></span></p>
				<p>読み込む swf （サンプルでは&#8221;elements.swf&#8221;）は、ライブラリにてクラス名&#8221;Mc_a&#8221;としてリンケージ書き出しだけしてます。<br />
				AS3自体の基本的なやり方としては大重さんの下記記事が超絶わかりやすい。<br />
				<a href="http://www.adobe.com/jp/newsletters/edge/october2009/articles/article2/">大重美幸の「これ見落としてませんか？　ActionScript 3.0」<br />
				第2回 外部 swf ファイルのシンボルを利用する</a></p>
				<p>んで、てきとうな Scene クラスの、 atSceneInit や atSceneLoad で</p>
				<pre class="brush: as3; title: ; notranslate">
			addCommand(
				new LoadSWF(new URLRequest(&quot;elements.swf&quot;), null,
					{
						onComplete:function():void
						{
							var ld:Loader = this.loader;
							var domain:ApplicationDomain = ld.contentLoaderInfo.applicationDomain;
							var Mc:Class = domain.getDefinition(&quot;Mc_a&quot;) as Class;
							mc = new Mc();
							manager.root.container.addChild(mc);
						}
					}
				)
			);
</pre>
				<p>ハマったのは、 Loader とるとことか AppricationDomain とかのところ。<br />
				まだいまいち、 それぞれの this とか、処理の順番つかみきれてない感じ。</p>
]]></content:encoded>
			<wfw:commentRss>http://mrhdms.iixx.jp/2010/03/15/progression4-loadswf-getdefinition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://mrhdms.iixx.jp/2010/03/15/progression4-loadswf-getdefinition/" />
	</item>
		<item>
		<title>FlashのムービープレビューでstageHeightの値がおかしい</title>
		<link>http://mrhdms.iixx.jp/2010/03/11/stageheight_movie_preview/</link>
		<comments>http://mrhdms.iixx.jp/2010/03/11/stageheight_movie_preview/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 17:09:43 +0000</pubDate>
		<dc:creator>mrhdms</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[stageHeight]]></category>
		<category><![CDATA[小ネタ]]></category>

		<guid isPermaLink="false">http://mrhdms.iixx.jp/?p=77</guid>
		<description><![CDATA[しばらく謎のまま放置してたけど（特に本番環境に影響ないので） ふとしたきっかけで解決したのでメモメモ。 Flash IDE（CS3から？）で制作してる時で、さらに StageScaleMode.NO_SCALE と設定し [...]]]></description>
			<content:encoded><![CDATA[				<p>しばらく謎のまま放置してたけど（特に本番環境に影響ないので）<br />
				ふとしたきっかけで解決したのでメモメモ。</p>
				<p>Flash IDE（CS3から？）で制作してる時で、さらに StageScaleMode.NO_SCALE と設定してるとき、<br />
				ムービープレビューすると、stage.stageHeight がうまく取れないときがあった。<br />
				これはプレビュー表示の Flash Player の状態から影響を受けていた模様。<span id="more-77"></span></p>
				<p>通常は、こんな感じ。<br />
				（ステージを300*200、テキストフィールドをstageHeightを使って中央配置）<br />
				<a href="http://mrhdms.iixx.jp/wp/wp-content/uploads/2010/03/100310_2.png"><img class="aligncenter size-medium wp-image-78" title="100310_2" src="http://mrhdms.iixx.jp/wp/wp-content/uploads/2010/03/100310_2-300x245.png" alt="テキスト中央配置" width="300" height="245" /></a><br />
				ちゃんと 200 取れてるし、中央にきてる。</p>
				<p>プロファイラを表示させてると、こうなる。<br />
				<a href="http://mrhdms.iixx.jp/wp/wp-content/uploads/2010/03/100310_1.png"><img class="aligncenter size-medium wp-image-79" title="100310_1" src="http://mrhdms.iixx.jp/wp/wp-content/uploads/2010/03/100310_1-199x300.png" alt="プロファイラを表示させてるとこうなる。" width="199" height="300" /></a><br />
				取得した値は 100 となってしまって、中央配置もずれてる。</p>
				<p>また、ステージが極端に小さいと、ウィンドウのメニューバーが折り返した際も同様に取得する値が狂います。<br />
				実際、本番環境に設置してしまったり、パブリッシュしてブラウザでプレビューすれば関係ないけど、<br />
				日々のムービープレビューに悩まされていたので、すっきり！</p>
				<p>以上、小ネタでした。</p>
]]></content:encoded>
			<wfw:commentRss>http://mrhdms.iixx.jp/2010/03/11/stageheight_movie_preview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://mrhdms.iixx.jp/2010/03/11/stageheight_movie_preview/" />
	</item>
		<item>
		<title>BetweenAS3 に overwrite 的な機能が実装されてた</title>
		<link>http://mrhdms.iixx.jp/2010/02/18/betweenas3-overwrite/</link>
		<comments>http://mrhdms.iixx.jp/2010/02/18/betweenas3-overwrite/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 18:46:48 +0000</pubDate>
		<dc:creator>mrhdms</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[BetweenAS3]]></category>

		<guid isPermaLink="false">http://mrhdms.iixx.jp/?p=52</guid>
		<description><![CDATA[overwite なくてブーブーいってたわけですけど、 実装されてたみたいですね。 [r3422] オーバーライトっぽい挙動をするように変更 Tweener のように古いトゥイーンを停止はしませんが、新しいトゥイーンの値 [...]]]></description>
			<content:encoded><![CDATA[				<p><a href="http://mrhdms.iixx.jp/2010/01/31/begin-betweenas3-overwrite/">overwite なくてブーブーいってたわけですけど、<br />
				</a><a href="http://www.libspark.org/changeset/3422">実装</a>されてたみたいですね。</p>
				<blockquote><p>[r3422] オーバーライトっぽい挙動をするように変更<br />
				Tweener のように古いトゥイーンを停止はしませんが、新しいトゥイーンの値が優先されるようになりました</p></blockquote>
				<p>とのこと。<span id="more-52"></span></p>
				<p>前回のエントリで書いた通り、これまでは Tween が動いているかチェックして、動いている場合は止めてから次の Tween を設定する必要がありました。</p>
				<pre class="brush: as3; title: ; notranslate">
	if (_tw_A != null)
	{
		_tw_A.stop();
	}
</pre>
				<p>こんな感じで。それがなくて済むので、ロールオーバーボタンなんかはやっぱずいぶん楽になると思います。<br />
				ただ、上に書いた通り、「新しいトゥイーンが優先される」だけなので、この点だけ気をつけないといけないですね！</p>
				<p style="text-align: center;"><object style="width: 300px; height: 200px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="200" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="quality" value="high" /><param name="src" value="http://mrhdms.iixx.jp/wp/wp-content/uploads/2010/02/Main2.swf" /><embed style="width: 300px; height: 200px;" type="application/x-shockwave-flash" width="300" height="200" src="http://mrhdms.iixx.jp/wp/wp-content/uploads/2010/02/Main2.swf" quality="high"></embed></object></p>
				<p>円の図形にロールオーバーとアウトを繰り返すと、別々にイベントを取れているのが確認できるかと思います。</p>
]]></content:encoded>
			<wfw:commentRss>http://mrhdms.iixx.jp/2010/02/18/betweenas3-overwrite/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://mrhdms.iixx.jp/2010/02/18/betweenas3-overwrite/" />
	</item>
	</channel>
</rss>

