<?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>イテルの一日一問 &#187; 音楽再生</title>
	<atom:link href="http://oneday.ter.jp/tag/%e9%9f%b3%e6%a5%bd%e5%86%8d%e7%94%9f/feed" rel="self" type="application/rss+xml" />
	<link>http://oneday.ter.jp</link>
	<description>一日にひとつは何かを考える。</description>
	<lastBuildDate>Mon, 31 Jan 2011 09:23:33 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://oneday.ter.jp/tag/%e9%9f%b3%e6%a5%bd%e5%86%8d%e7%94%9f/feed" />
		<item>
		<title>Flash（as3）で音楽を再生する｜ロールオーバー</title>
		<link>http://oneday.ter.jp/actionscript3/139.html</link>
		<comments>http://oneday.ter.jp/actionscript3/139.html#comments</comments>
		<pubDate>Thu, 18 Jun 2009 05:15:55 +0000</pubDate>
		<dc:creator>イテル</dc:creator>
				<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[音楽再生]]></category>

		<guid isPermaLink="false">http://oneday.ter.jp/?p=139</guid>
		<description><![CDATA[昨日に引き続き、as3でmp3を再生する方法。 「ボタンのロールオーバー時に再生」のやつ。 っていうか簡単だった。 普通にロールオーバー時に再生してロールアウトに再生をやめればいいだけ。 If you can see t [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-thumbnail wp-image-148" title="090617" src="http://oneday.ter.jp/wp-content/uploads/2009/06/090617-700x200.jpg" alt="090617" width="700" height="200" /></p>
<p>昨日に引き続き、as3でmp3を再生する方法。</p>
<p>「ボタンのロールオーバー時に再生」のやつ。</p>
<p>っていうか簡単だった。</p>
<p>普通にロールオーバー時に再生してロールアウトに再生をやめればいいだけ。</p>
<pre class="brush: as3; title: ; notranslate">
import caurina.transitions.Tweener;

var sound_obj;    // サウンドオブジェクト
var channel;    // サウンドチャンネル
var url;

//サウンドファイルを選択
url = new URLRequest(&quot;http://domain.domain/path.mp3&quot;);
sound_obj = new Sound(url);
channel = null;

//ボタンとイベントを関連付ける
button1.addEventListener(MouseEvent.ROLL_OVER,playSound)
button1.addEventListener(MouseEvent.ROLL_OUT,stopSound)

function playSound(event:MouseEvent){
Tweener.addTween(button1,{ alpha:0.5 });
if(channel){
channel.stop();
}
if(sound_obj){
//9999回リピートさせ再生
channel = sound_obj.play(0, 99999);
}
}

function stopSound(event:MouseEvent){
Tweener.addTween(button1,{ alpha:1 });
//再生停止
if(channel){
channel.stop();
}
}
</pre>
<p><object type="application/x-shockwave-flash" style="width:300px;height:200px" data="http://oneday.ter.jp/swf_data/090618/test02.swf"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="quality" value="best" /><param name="wmode" value="transparent" /><param name="movie" value="http://oneday.ter.jp/swf_data/090618/test02.swf" /><param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer" />If you can see this, then you might need a Flash Player upgrade or you need to install Flash Player if it's missing. Get <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash Player</a> from Adobe.</object><br/>
		<!-- Valid XHTML flash object delivered by XHTML Video Embed. Get it at: http://saltwaterc.net/xhtml-video-embed -->
		</p>
<p>今回もiLifeで作成した音源ｗ</p>
<p>通常のボタン効果音であれば、埋め込みの方がいいかも知れませんね・・・。</p>
<p>それは後日。</p>
]]></content:encoded>
			<wfw:commentRss>http://oneday.ter.jp/actionscript3/139.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://oneday.ter.jp/actionscript3/139.html" />
	</item>
		<item>
		<title>Flash（as3）で音楽を再生する</title>
		<link>http://oneday.ter.jp/actionscript3/122.html</link>
		<comments>http://oneday.ter.jp/actionscript3/122.html#comments</comments>
		<pubDate>Wed, 17 Jun 2009 13:58:15 +0000</pubDate>
		<dc:creator>イテル</dc:creator>
				<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[音楽再生]]></category>

		<guid isPermaLink="false">http://oneday.ter.jp/?p=122</guid>
		<description><![CDATA[私はまだFlashで音楽をつけたものを作ったことがない。 たとえば、ボタンであったり、バックグラウンドであったり、音がついているとよりクオリティが高く感じるようになるのでは？と思う。 昨日、iLifeをいじったことで、さ [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-thumbnail wp-image-150" title="090617" src="http://oneday.ter.jp/wp-content/uploads/2009/06/0906171-700x200.jpg" alt="090617" width="700" height="200" /></p>
<p>私はまだFlashで音楽をつけたものを作ったことがない。</p>
<p>たとえば、ボタンであったり、バックグラウンドであったり、音がついているとよりクオリティが高く感じるようになるのでは？と思う。</p>
<p>昨日、iLifeをいじったことで、さらにその欲求が高まった。</p>
<p><a href="http://hakuhin.hp.infoseek.co.jp/index.html" target="_blank">HAKUHIN&#8217;s home page</a>さんを参考にさせていただいたところ、Flash（Actionscript3）で音楽を鳴らすのは、次のようなコードを書けば良いようだ。</p>
<pre class="brush: as3; title: ; notranslate">
var url : URLRequest = new URLRequest(&quot;hoge/test.mp3&quot;);
var sound_obj : Sound = new Sound(url);
sound_obj.play(0,3);
</pre>
<p>参考ページ：<a href="http://hakuhin.hp.infoseek.co.jp/main/as3/sound.html#SOUND_01" target="_blank">サウンドについて</a></p>
<p>これだけでは、勝手に再生して勝手に終了するだけなので、再生ボタンや停止ボタンが必要になる。</p>
<pre class="brush: as3; title: ; notranslate">
var sound_obj;    // サウンドオブジェクト
var channel;    // サウンドチャンネル
var url;

//サウンドファイルを選択
url = new URLRequest(&quot;http://domain.domain/path.mp3&quot;);
sound_obj = new Sound(url);
channel = null;

// 再生ボタンを押したとき
play_b.addEventListener(MouseEvent.CLICK,function(event){
//現在再生中の音楽を停止
if(channel){
channel.stop();
}

if(sound_obj){
//9999回リピートさせ再生
channel = sound_obj.play(0, 99999);
}
});

// 停止ボタン
stop_b.addEventListener(MouseEvent.CLICK,function(event){
//再生停止
if(channel){
channel.stop();
}
});
</pre>
<p>で、出来上がったのがこれ。</p>
<p><object type="application/x-shockwave-flash" style="width:80px;height:50px" data="http://oneday.ter.jp/swf_data/090618/test01.swf"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="quality" value="best" /><param name="wmode" value="transparent" /><param name="movie" value="http://oneday.ter.jp/swf_data/090618/test01.swf" /><param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer" />If you can see this, then you might need a Flash Player upgrade or you need to install Flash Player if it's missing. Get <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash Player</a> from Adobe.</object><br/>
		<!-- Valid XHTML flash object delivered by XHTML Video Embed. Get it at: http://saltwaterc.net/xhtml-video-embed -->
		</p>
<p>ちなみに音源は昨日iLifeで作成したやっつけ太鼓ミュージックｗ</p>
<p>- &#8211; -</p>
<p>この他に音量の調整やイコライザなんてものもあるとよりベストかな。</p>
<p>また、ボタンの効果音として使用したい場合は、ボタンにマウスオーバーしたときに再生したりしなきゃならん。</p>
<p>それは・・・また次の機会に。</p>
]]></content:encoded>
			<wfw:commentRss>http://oneday.ter.jp/actionscript3/122.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://oneday.ter.jp/actionscript3/122.html" />
	</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.293 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-02-09 15:47:59 -->

