<?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>parpue.net &#187; スライダー</title>
	<atom:link href="http://parpue.net/tag/slider/feed" rel="self" type="application/rss+xml" />
	<link>http://parpue.net</link>
	<description>Flash, Flex, デザイン等自分の好きなことを好きなようにやってます</description>
	<lastBuildDate>Wed, 12 Aug 2009 17:46:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Flex3のSliderにスキン適用してビデオシーク</title>
		<link>http://parpue.net/web/267</link>
		<comments>http://parpue.net/web/267#comments</comments>
		<pubDate>Tue, 02 Sep 2008 11:11:38 +0000</pubDate>
		<dc:creator>okm</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[Flex3]]></category>
		<category><![CDATA[スキン]]></category>
		<category><![CDATA[スライダー]]></category>
		<category><![CDATA[ビデオ]]></category>

		<guid isPermaLink="false">http://parpue.net/?p=267</guid>
		<description><![CDATA[				Flex3でスライドバーでビデオをシークする処理について、
				職場でちょっと聞かれたので、サンプルを作ってみました。
				*ちょっと修正しました。
				
				前にバンドのHP用に作ったFLVを使 [...]]]></description>
			<content:encoded><![CDATA[				<p>Flex3でスライドバーでビデオをシークする処理について、<br />
				職場でちょっと聞かれたので、サンプルを作ってみました。</p>
				<p>*ちょっと修正しました。</p>
				<p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="SliderTest" width="370" height="454" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"><param name="movie" value="/wp-content/uploads/slidertest.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#869ca7" /><param name="allowScriptAccess" value="sameDomain" /><embed src="/wp-content/uploads/slidertest.swf" quality="high" bgcolor="#869ca7" width="370" height="454" name="SliderTest" align="middle" play="true"	loop="false"	quality="high"　allowScriptAccess="sameDomain"　type="application/x-shockwave-flash"　pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object></p>
				<p>前にバンドのHP用に作ったFLVを使いました、動きのないビデオでごめんなさい…。<br />
				音声は出るのでそちらで動画が移動しているのをご確認いただけると思います…。<br />
				ロード完了後に「再生」ボタンで再生です。</p>
				<p>せっかくなので、SliderのSkinに、自作画像を重ねたものも使いました。</p>
				<p>重ねた画像はこちらです。45秒でかきました。<br />
				<img src="http://parpue.net/wp-content/uploads/slide_button.png" alt="" title="slide_button" width="25" height="25" class="alignnone size-full wp-image-268" />&nbsp;<img src="http://parpue.net/wp-content/uploads/slidebar-300x22.png" alt="" title="slidebar" width="300" height="22" class="alignnone size-medium wp-image-269" /></p>
				<p>↓　以下詳細、プロジェクトファイル等です。<br />
				<span id="more-267"></span><br />
				<a href='http://parpue.net/wp-content/uploads/slidertest.zip'>プロジェクトファイルはこちら。</a><br />
				FLVファイルは含まれていません。<br />
				一応アップ→ <a href='http://parpue.net/wp-content/uploads/bandplay.flv' rel='shadowbox[post-267]'>bandplay.flv</a></p>
				<p>Flex3のVideoDisplayコンポーネントは、動画をロードする機能も備えています。<br />
				sourceプロパティで、読み込む動画ファイルのパスを指定し、<br />
				load() を呼ぶだけで動画を読み込むことが可能です。</p>
				<div class="igBar"><span id="lactionscript-6"><a href="#" onclick="javascript:showPlainTxt('actionscript-6'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-6">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #0066CC;">video</span>.<span style="color: #006600;">source</span> = <span style="color: #ff0000;">"bandPlay.flv"</span>;</li>
				<li style="color:#26536A;"><span style="color: #0066CC;">video</span>.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </li>
				</ol>
				</div>
				</div>
				</div>
				<p>あとは互いのコンポーネントのイベントによって、<br />
				ビデオの再生ヘッドや、スライダーのボタンの位置を変更することで、<br />
				簡単な動画プレイヤーを作成することができます。</p>
				<p>↓VideoDisplayのplayheadUpdateイベントで、Sliderのボタン位置を変更する。</p>
				<div class="igBar"><span id="lactionscript-7"><a href="#" onclick="javascript:showPlainTxt('actionscript-7'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-7">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> videoOnPlayHeadUpdate<span style="color: #66cc66;">&#40;</span>event:VideoEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">slider</span>.<span style="color: #006600;">value</span> = event.<span style="color: #006600;">playheadTime</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">slider2</span>.<span style="color: #006600;">value</span> = event.<span style="color: #006600;">playheadTime</span>;</li>
				<li style="color:#26536A;"><span style="color: #66cc66;">&#125;</span> </li>
				</ol>
				</div>
				</div>
				</div>
				<p><span style="color:#FF3333">＊追記<br />
				VideoDisplayのreadyイベント時に、<br />
				ビデオの最大長、totalTimeは必ずセットされているわけではないようです。<br />
				なので、ビデオの再生ヘッドが変わるたびにSliderの最大長も更新してあげます。</span></p>
				<div class="igBar"><span id="lactionscript-8"><a href="#" onclick="javascript:showPlainTxt('actionscript-8'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-8">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">//修正後</span></li>
				<li style="color:#26536A;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> videoOnPlayHeadUpdate<span style="color: #66cc66;">&#40;</span>event:VideoEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">slider</span>.<span style="color: #006600;">maximum</span> = <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">video</span>.<span style="color: #006600;">totalTime</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">slider2</span>.<span style="color: #006600;">maximum</span> = <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">video</span>.<span style="color: #006600;">totalTime</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">slider</span>.<span style="color: #006600;">value</span> = event.<span style="color: #006600;">playheadTime</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">slider2</span>.<span style="color: #006600;">value</span> = event.<span style="color: #006600;">playheadTime</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #66cc66;">&#125;</span> </li>
				</ol>
				</div>
				</div>
				</div>
				<p>↓Sliderのchangeイベントで、VideoDisplayの再生ヘッドを変更する</p>
				<div class="igBar"><span id="lactionscript-9"><a href="#" onclick="javascript:showPlainTxt('actionscript-9'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-9">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> sliderChangeHandler<span style="color: #66cc66;">&#40;</span>event:SliderEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">video</span>.<span style="color: #006600;">playheadTime</span> = event.<span style="color: #006600;">value</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #66cc66;">&#125;</span> </li>
				</ol>
				</div>
				</div>
				</div>
				<p>これで互いの位置を反映することが可能となりました。</p>
				<p>今回はHSliderを継承し、<br />
				見た目のスキンを変更したMySliderというクラスも作ってみました。</p>
				<p>シークバーのボタンは自動的に小さくしてくれるみたいですね。<br />
				というかサイズはスタイルでは返られないようです。</p>
				<p>↓MySliderクラス スライドバーの部分と、スライドするボタンの部分を変更しているだけです。</p>
				<div class="igBar"><span id="lactionscript-10"><a href="#" onclick="javascript:showPlainTxt('actionscript-10'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-10">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">package</li>
				<li style="color:#26536A;"><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">HSlider</span>;</li>
				<li style="color:#26536A;">&nbsp;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyHSlider <span style="color: #0066CC;">extends</span> HSlider</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// skin 変更用にpngをインクルード</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source = <span style="color: #ff0000;">"slidebar.png"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> slidebar:<span style="color: #000000; font-weight: bold;">Class</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source = <span style="color: #ff0000;">"slide_button.png"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> slidesum:<span style="color: #000000; font-weight: bold;">Class</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MyHSlider<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// スキンの変更</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"thumbSkin"</span>, slidesum<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"trackSkin"</span>, slidebar<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;"><span style="color: #66cc66;">&#125;</span> </li>
				</ol>
				</div>
				</div>
				</div>
				<p>その他設定できるオプションについてはリファレンスで確認できます。<br />
				→　<a href="http://livedocs.adobe.com/flex/3_jp/langref/mx/controls/sliderClasses/Slider.html">http://livedocs.adobe.com/flex/3_jp/langref/mx/controls/sliderClasses/Slider.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://parpue.net/web/267/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

