<?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/"
	>

<channel>
	<title>モウソウチク日記 &#187; AS2</title>
	<atom:link href="http://www.mousouchiku.net/blog/tag/as2/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mousouchiku.net/blog</link>
	<description>Webデザインについて、のんびり更新中</description>
	<lastBuildDate>Tue, 03 Jan 2012 21:58:39 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>[AS2]Flashで外部から読み込んだ画像データにスムージングを適用する</title>
		<link>http://www.mousouchiku.net/blog/2009/04/21-003246.php?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=as2flash%25e3%2581%25a7%25e5%25a4%2596%25e9%2583%25a8%25e3%2581%258b%25e3%2582%2589%25e8%25aa%25ad%25e3%2581%25bf%25e8%25be%25bc%25e3%2582%2593%25e3%2581%25a0%25e7%2594%25bb%25e5%2583%258f%25e3%2583%2587%25e3%2583%25bc%25e3%2582%25bf%25e3%2581%25ab%25e3%2582%25b9%25e3%2583%25a0%25e3%2583%25bc%25e3%2582%25b8%25e3%2583%25b3</link>
		<comments>http://www.mousouchiku.net/blog/2009/04/21-003246.php#comments</comments>
		<pubDate>Mon, 20 Apr 2009 15:32:46 +0000</pubDate>
		<dc:creator>オオサワ アツシ</dc:creator>
				<category><![CDATA[ActionScript2.0]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[AS2]]></category>

		<guid isPermaLink="false">http://www.mousouchiku.net/blog/?p=100</guid>
		<description><![CDATA[Flashで外部から画像データを読み込んで、リサイズしたり回転させたりして使用する場合、シャギーが出てギザギザが目立ってしまう。Flash Player7だと、何もしなくてもスムージングがかかった状態で表示されていたみた &#8230; <a href="http://www.mousouchiku.net/blog/2009/04/21-003246.php">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Flashで外部から画像データを読み込んで、リサイズしたり回転させたりして使用する場合、シャギーが出てギザギザが目立ってしまう。Flash Player7だと、何もしなくてもスムージングがかかった状態で表示されていたみたいで、問題なかったのだけど、8以上だとギザギザになってしまう。いろいろ調べてみたら、Flash Player8から仕様が変更になったらしく、ひと手間かけないとスムージングが適用できない模様。よく使いそうなのでメモ。</p>
<p>flaファイルと同じ階層に「photo.jpg」を用意して、メインのタイムラインの1フレーム目に、下記スクリプトを記述すれば、外部画像にスムージングを適用可能（AS2です）。</p>
<pre lang="actionscript">
import flash.display.BitmapData;

this.createEmptyMovieClip("containerOriginal", this.getNextHighestDepth());
this.createEmptyMovieClip("containerSmoothing", this.getNextHighestDepth());

var listenerObj:Object = new Object();
listenerObj.onLoadInit = function(){
	bitmapSmoothing();
}
var mcl:MovieClipLoader = new MovieClipLoader();
mcl.addListener(listenerObj);
mcl.loadClip("photo.jpg", this.containerOriginal);

function bitmapSmoothing() {
	var smoothImage:BitmapData = new BitmapData(this.containerOriginal._width, this.containerOriginal._height, true, 0x000000);
	smoothImage.draw(this.containerOriginal);
	this.containerSmoothing.attachBitmap(smoothImage, 0, "auto", true);
	this.containerOriginal.removeMovieClip();
}
</pre>
<p>画像を読み込んで、読み込みが完了したら、BitmapDataに変換してスムージングを適用して元画像をリムーブという流れ。元画像の読み込みが完全に完了してから、スムージング処理をしないと、うまく動作しないみたいなので注意。このスクリプトの場合、onLoadInitでロード完了を取得して、bitmapSmoothing関数でスムージングを適用してます。</p>
<p>元画像をリムーブしないで、角度をつけて比較してみるとこんな感じ（左がスムージング適用前で、右がスムージング適用後）。</p>
<p><img src="http://www.mousouchiku.net/blog/wp-content/uploads/2009/04/smoothing.png" alt="" title="smoothing" width="452" height="237" class="alignnone size-full wp-image-113" /></p>
<p>ライブラリから読み込む場合は、プロパティからスムージングの適用を選択できるので問題はないけど、スクリプトベースで外部から引っ張ってくる場合は、こんな感じで解決するみたいです。もっと簡単な方法とかあるのかもしれないけど、とりあえずこの方法で解決しました。</p>
<p>【参考にさせて頂いたサイト】<br />
<a href="http://feb19.jp/blog/archives/000150.php">AS2で読み込んだ外部画像にスムージングを適用する</a><br />
<a href="http://www.flash-jp.com/modules/newbb/viewtopic.php?viewmode=flat&#038;topic_id=4835&#038;forum=6">FLASH8-ビットマップスムージングをスクリプトで制御したい</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mousouchiku.net/blog/2009/04/21-003246.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

