<?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>Chris Pitzer &#187; flash</title>
	<atom:link href="http://blog.christopherpitzer.com/category/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.christopherpitzer.com</link>
	<description>web development, games, business, optimism</description>
	<lastBuildDate>Tue, 09 Feb 2010 22:50:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>adding a Slideshow feature to a SimpleViewer gallery</title>
		<link>http://blog.christopherpitzer.com/2007/adding-a-slideshow-feature-to-a-simpleviewer-gallery/</link>
		<comments>http://blog.christopherpitzer.com/2007/adding-a-slideshow-feature-to-a-simpleviewer-gallery/#comments</comments>
		<pubDate>Wed, 03 Oct 2007 22:59:17 +0000</pubDate>
		<dc:creator>Christopher Pitzer</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[how-to]]></category>

		<guid isPermaLink="false">http://blog.christopherpitzer.com/?p=12</guid>
		<description><![CDATA[SimpleViewer is a great, easy to impliment, polished little gallery written in flash that lets you tie your photos and thumbnails in with XML.  It&#8217;s got a decent feature set as far as changing the aesthetic of the viewer, but no option for an automated slideshow.
One of my clients wanted this option, and it [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.airtightinteractive.com/simpleviewer/" target="_blank">SimpleViewer</a> is a great, easy to impliment, polished little gallery written in flash that lets you tie your photos and thumbnails in with XML.  It&#8217;s got a decent feature set as far as changing the aesthetic of the viewer, but no option for an automated slideshow.</p>
<p>One of my clients wanted this option, and it took me a while to figure it out &#8211; so for those of you who are wondering <strong>how to incorporate a slideshow into simpleviewer, here&#8217;s how</strong>!</p>
<p>My finished project can be seen at <a href="http://www.sixeightythreephoto.com" title="Six Eighty Three Photo - St Louis Wedding Photographer" target="_blank">SixEightyThreePhoto.com</a></p>
<p>(note &#8211; if you&#8217;re going for the free version of SimpleViewer this won&#8217;t help you &#8211; you need access to the source code, so you will need SimpleViewer Pro for this)</p>
<p><strong>Step one &#8211; simpleviewer.fla</strong></p>
<ol>
<li>Open simpleviewer.fla</li>
<li>Create a new layer in the timeline.</li>
<li>Create a keyframe by selecting frame 30 on your new timeline and hitting F6.</li>
<li>Create your start/stop button and put it here, on this keyframe, on this layer.  I&#8217;m calling mine ssButton.   (for those in the know, I&#8217;m not really using a &#8220;button&#8221; element&#8230; I find them awkward to work with&#8230;  I&#8217;m using a MovieClip as a button&#8230; but really, either way should work)</li>
<li>Now we&#8217;re going to need a bit of code.  This is all pretty simple stuff.  A setInterval to iterate the slideshow, and instead of having a boolean to look at to determine whether or not the slideshow is playing, I&#8217;m just looking at whether the &#8220;play&#8221; layer of the button is visible.  Open up the actions panel (F9) and copy this&#8230;</li>
</ol>
<blockquote><p>var nInterval:Number;</p>
<p>ssButton.onRelease = function():Void {<br />
&nbsp;&nbsp;&nbsp;&nbsp;ssButton.mcPlay._visible = !ssButton.mcPlay._visible;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;clearInterval(nInterval);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;if(!ssButton.mcPlay._visible) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nInterval = setInterval(slideshow, 3000);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sm.ssNext();<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</p>
<p>function slideshow():Void {<br />
&nbsp;&nbsp;&nbsp;&nbsp;sm.ssNext();<br />
}</p></blockquote>
<p><strong>Step two &#8211; StageManager.as</strong><br />
I wish I knew a better way to do this, but I guess  it&#8217;s not too painful&#8230; What we&#8217;re going to do here is pass our function call right on to another class instance.  So at the bottom of StageManager, right before the last close brace, add this function&#8230;</p>
<blockquote><p>public function ssNext() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;mImageArea.ssNext();<br />
}</p></blockquote>
<p><strong>Step three &#8211; ImageArea.as</strong><br />
Here&#8217;s where we actually, finally, DO something.   Place this function right before the last close brace at the  end of the file&#8230;</p>
<blockquote><p>public function ssNext():Void {<br />
&nbsp;&nbsp;&nbsp;&nbsp;var nStart:Number = mCurrentImageIndex;<br />
&nbsp;&nbsp;&nbsp;&nbsp;mThumbArea.selectedThumbIndex++;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;if(nStart == mCurrentImageIndex)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mThumbArea.selectedThumbIndex = 0;<br />
}</p></blockquote>
<p>Ta-Da!!  If you built your button right, you now have working slideshow button in SimpleViewer!  You&#8217;ll have to publish the simpleviewer.fla file again to get the updated version of your viewer.swf,  and then you&#8217;ll probably have to tinker a bit to get the button in the right place &#8211; but that&#8217;s kid stuff.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.christopherpitzer.com/2007/adding-a-slideshow-feature-to-a-simpleviewer-gallery/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
