<?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>Mike Richards Photography Blog &#187; deeplinking</title>
	<atom:link href="http://www.mikerichardsphotography.com/blog/tag/deeplinking/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mikerichardsphotography.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 08 Sep 2010 17:18:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How To: SimpleViewer 2 and SWFAddress.</title>
		<link>http://www.mikerichardsphotography.com/blog/2010/01/28/how-to-simpleviewer-2-and-swfaddress/</link>
		<comments>http://www.mikerichardsphotography.com/blog/2010/01/28/how-to-simpleviewer-2-and-swfaddress/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 18:07:54 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[deep linking]]></category>
		<category><![CDATA[deeplinking]]></category>
		<category><![CDATA[flash gallery]]></category>
		<category><![CDATA[simpleviewer]]></category>
		<category><![CDATA[swfaddress]]></category>

		<guid isPermaLink="false">http://www.mikerichardsphotography.com/blog/?p=91</guid>
		<description><![CDATA[As this is an update to an existing post I will dispense with a basic introduction. The major difference between this post and the previous is that the new version uses Actionscript 3. Here is the deep linking example of SimpleViewer 2 and SWFAddress 2.4. What you will need to download: SimpleViewer Pro 2.0.1 SWFAddress [...]]]></description>
			<content:encoded><![CDATA[<p>As this is an update to an <a href="http://www.mikerichardsphotography.com/blog/2009/05/15/how-to-adding-swfaddress-to-simpleviewer/">existing post</a> I will dispense with a basic introduction. The major difference between this post and the previous is that the new version uses Actionscript 3. Here is the deep linking <a href="http://www.mikerichardsphotography.com/example/SV2withSWFAddress/">example of SimpleViewer 2 and SWFAddress 2.4</a>.</p>
<p>What you will need to download:</p>
<ul>
<li><a href="http://www.simpleviewer.net/simpleviewer/pro/">SimpleViewer Pro 2.0.1</a></li>
<li><a href="http://www.asual.com/download/swfaddress">SWFAddress 2.4</a></li>
<li>If you don&#8217;t have it <a href="http://www.adobe.com/products/flash/">Adobe Flash Professional</a></li>
</ul>
<p><span id="more-91"></span><br />
Make a new folder on your desktop – you can call it whatever you would like, for the tutorial I&#8217;m going to call mine <strong>gallery</strong>. </p>
<p>Extract the file you download from the SimpleViwer site, simpleviewer-pro.zip.</p>
<p>Copy all of the files in the <strong>flash_embed</strong> folder into your <strong>gallery</strong> folder. You will find the Flash Embed example in the SimpleViewer folder you created when you extracted the simpleviewer-pro.zip under <strong>simpleviewer-pro2_1/examples/flash_embed</strong>.</p>
<p>Rename simpleviewer_flash_embed.fla to simpleviewer_swfaddress.fla, delete  simpleviewer_flash_embed.swf and simpleviewer_flash_embed.html.</p>
<p>Unzip swfaddress-2.4zip</p>
<p>Copy the <strong>asual</strong> folder found in <strong>swfaddress-2.4\dist\as\3\com\</strong> to <strong>gallery\com\</strong>.</p>
<p>Copy swfaddress.js from <strong>swfaddress-2.4\dist\js</strong> to the <strong>gallery</strong> folder.</p>
<p>In the <strong>gallery</strong> folder right click new>text document. Rename the text file to index.html.</p>
<p>You should now have all of the files you need in the <strong>gallery</strong> folder:</p>
<ul>
<li>com folder</li>
<li>images folder</li>
<li>thumbs folder</li>
<li>gallery_1.xml</li>
<li>gallery_2.xml</li>
<li>index.html</li>
<li>simpleviewer_swfaddress.fla</li>
<li>simpleviewer.swf</li>
<li>swfaddress.js</li>
</ul>
<p>In your <strong>gallery</strong> folder open index.html and copy the following code into index.html:</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a> xmlns<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span> xml:<span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;en&quot;</span> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;en&quot;</span>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/meta.html"><span style="color: #000000; font-weight: bold;">meta</span></a> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/html; charset=utf-8&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">title</span></a>&gt;</span>Simpleviewer Gallery with SWFAdress<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">title</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;swfaddress.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var flashvars = {};<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var params = {};<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; params.scale = &quot;noscale&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; params.allowfullscreen = &quot;true&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; params.allowScriptAccess = &quot;sameDomain&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; swfobject.embedSWF(&quot;simpleviewer_swfaddress.swf&quot;, &quot;galleryContent&quot;, &quot;900&quot;, &quot;670&quot;, &quot;10.0.0&quot;, false, flashvars, params);<br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/style.html"><span style="color: #000000; font-weight: bold;">style</span></a> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;screen&quot;</span>&gt;</span><br />
&nbsp; &nbsp; object { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outline:none; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; body {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; margin:0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; padding:0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/style.html"><span style="color: #000000; font-weight: bold;">style</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;galleryContent&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;</span>In order to view these galleries you must have <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&quot;</span>&gt;</span>Adobe Flash Player<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;</span> installed. <br />
&nbsp; &nbsp; If you know that you have Flash installed, then please ensure JavaScript and/or Active Content are enabled.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>In your <strong>gallery</strong> folder open simpleviewer_swfaddress.fla with Adobe Flash Professional. Delete all the buttons and the text box, with the exception of the Load Gallery 1 and 2 buttons. (Feel free to change the background color so it&#8217;s not so hard to look at.) </p>
<p><img src="http://www.mikerichardsphotography.com/blog/wp-content/uploads/2010/01/sv2swfaddress-withoutextrabuttons.jpg" alt="SimpleViewer 2 flash_embed example screen shot" title="sv2swfaddress-withoutextrabuttons" width="550" height="391" class="aligncenter size-full wp-image-101" /> </p>
<p>Now select the code layer&#8217;s Actions &#8211; Frame within the simpleviewer_swfaddress.fla document and replace the existing code with the following:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:700px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br />93<br />94<br />95<br />96<br />97<br />98<br />99<br />100<br />101<br />102<br />103<br />104<br />105<br />106<br />107<br />108<br />109<br />110<br />111<br />112<br />113<br />114<br />115<br />116<br />117<br />118<br />119<br />120<br />121<br />122<br />123<br />124<br />125<br />126<br />127<br />128<br />129<br />130<br />131<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">//Mike Rchards - mikerichardsphotography.com</span><br />
<span style="color: #808080; font-style: italic;">//This code is provided free without guarantee and is &quot;AS IS&quot;.</span><br />
<br />
<span style="color: #808080; font-style: italic;">//import required classes</span><br />
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #66cc66;">*</span>;<br />
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #006600;">URLRequest</span>; <br />
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">asual</span>.<span style="color: #006600;">swfaddress</span>.<span style="color: #66cc66;">*</span>;<br />
<br />
<span style="color: #808080; font-style: italic;">//turn off stage auto resizing</span><br />
<span style="color: #0066CC;">stage</span>.<span style="color: #0066CC;">scaleMode</span> = StageScaleMode.<span style="color: #006600;">NO_SCALE</span>;<br />
<span style="color: #0066CC;">stage</span>.<span style="color: #0066CC;">align</span> = StageAlign.<span style="color: #006600;">TOP_LEFT</span>; &nbsp; &nbsp; &nbsp;<br />
<br />
<span style="color: #808080; font-style: italic;">//Init variables</span><br />
<span style="color: #000000; font-weight: bold;">var</span> svAPI:<span style="color: #0066CC;">Object</span>; <span style="color: #808080; font-style: italic;">//svAPI is the object to call API methods on</span><br />
<span style="color: #000000; font-weight: bold;">var</span> swfLoaded:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">false</span>;<br />
<span style="color: #000000; font-weight: bold;">var</span> galleryURL:<span style="color: #0066CC;">String</span>; <span style="color: #808080; font-style: italic;">//used when switching between galleries</span><br />
<span style="color: #000000; font-weight: bold;">var</span> imageIndex:<span style="color: #0066CC;">Number</span>;<br />
<span style="color: #000000; font-weight: bold;">var</span> svLoader:Loader = <span style="color: #000000; font-weight: bold;">new</span> Loader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//loader to load SimpleViewer swf into</span><br />
<span style="color: #000000; font-weight: bold;">var</span> galleryShowing:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">true</span>;<br />
<br />
<span style="color: #808080; font-style: italic;">//the default galleryname should be the same as the name of the xml minus .xml</span><br />
<span style="color: #000000; font-weight: bold;">var</span> defaulGallery:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;gallery_1&quot;</span>;<br />
<span style="color: #000000; font-weight: bold;">var</span> currentGalName:<span style="color: #0066CC;">String</span> =<span style="color: #ff0000;">&quot;&quot;</span>;<br />
<br />
<span style="color: #808080; font-style: italic;">//add svLoader to the &quot;mcLoader&quot; stage movieclip on the main timeline</span><br />
mcLoader.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>svLoader<span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #808080; font-style: italic;">//listen for SWF loaded</span><br />
svLoader.<span style="color: #006600;">contentLoaderInfo</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">INIT</span>, onViewerInit<span style="color: #66cc66;">&#41;</span>;<br />
<br />
SWFAddress.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>SWFAddressEvent.<span style="color: #006600;">CHANGE</span>, handleSWFAddress<span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> handleSWFAddress<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:SWFAddressEvent<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> address = SWFAddress.<span style="color: #006600;">getValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> path = <span style="color: #0066CC;">e</span>.<span style="color: #006600;">path</span>;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> arr:<span style="color: #0066CC;">Array</span> = path.<span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;/&quot;</span><span style="color: #66cc66;">&#41;</span>; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> galName = arr<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> imgId:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">parseInt</span><span style="color: #66cc66;">&#40;</span>arr<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// If the gallery name is empty set to the default gallery.</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>galName == <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">||</span> galName == <span style="color: #ff0000;">&quot;unknown&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>galName = defaulGallery;<span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// If the image number is not a number set it to the first image.</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">isNaN</span><span style="color: #66cc66;">&#40;</span>imgId<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>imgId =<span style="color: #cc66cc;">0</span>;<span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; imageIndex = imgId;<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// If the galName is not the currentGalName load the new gallery.</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>galName <span style="color: #66cc66;">!</span>= currentGalName<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; loadGallery<span style="color: #66cc66;">&#40;</span>galName, imgId<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//Adds just the gallery name to the browser title bar. The title is taken from the gallery XML title.</span><br />
&nbsp; &nbsp; SWFAddress.<span style="color: #006600;">setTitle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Simpleviewer With SWFAdress &nbsp;: '</span> + galName<span style="color: #66cc66;">&#41;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Example of &nbsp;how to add the gallery name and image ID to the title bar.</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//SWFAddress.setTitle('Simpleviewer With SWFAdress &nbsp;: ' + galName +' image ' + &nbsp;imgId); </span><br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #808080; font-style: italic;">/**<br />
* This function loads the SimpleViewer SWF<br />
*/</span><br />
<span style="color: #000000; font-weight: bold;">function</span> loadGallery<span style="color: #66cc66;">&#40;</span>galName:<span style="color: #0066CC;">String</span>, imgId:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; currentGalName = galName;<br />
&nbsp; &nbsp; galleryURL = galName + <span style="color: #ff0000;">&quot;.xml&quot;</span>; <span style="color: #808080; font-style: italic;">//url;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//unload previous simpleviewer instance</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>svAPI <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span> svAPI.<span style="color: #006600;">dispose</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; svAPI = <span style="color: #000000; font-weight: bold;">null</span>;<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//flash 9 - unload</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>swfLoaded<span style="color: #66cc66;">&#41;</span> svLoader.<span style="color: #006600;">unload</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//Flash 10 - unloadAndStop </span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//if (_viewerLoaded) svLoader.unloadAndStop();</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; SWFAddress.<span style="color: #006600;">setValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'/'</span>+galName+<span style="color: #ff0000;">'/'</span>+imgId+<span style="color: #ff0000;">'/'</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//load simpleviewer swf</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> urlReq:URLRequest = <span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;simpleviewer.swf&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; svLoader.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span>urlReq<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; swfLoaded = <span style="color: #000000; font-weight: bold;">true</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> updateGalleryUrl<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> path = SWFAddress.<span style="color: #006600;">getValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> arr:<span style="color: #0066CC;">Array</span> = path.<span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;/&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> galName = arr<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//We are disregarding arr[2] because we are being </span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//passed the new image id, imgIndex, and don't need the current one.</span><br />
<br />
&nbsp; &nbsp; currentGalName = galName;<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// SWFAddress.setValue updates the address bar and calls handleChange(event:SWFAddressEvent)</span><br />
&nbsp; &nbsp; SWFAddress.<span style="color: #006600;">setValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'/'</span>+galName+<span style="color: #ff0000;">'/'</span>+<span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">data</span>+<span style="color: #ff0000;">'/'</span><span style="color: #66cc66;">&#41;</span>; &nbsp; &nbsp;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #808080; font-style: italic;">/**<br />
* Fired when preloader is available<br />
* Can set flashvars at this point<br />
*/</span> <br />
<span style="color: #000000; font-weight: bold;">function</span> onViewerInit<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;onViewerInit&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//listen for</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span>svLoader.<span style="color: #006600;">content</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;svComplete&quot;</span>, onGalleryLoaded<span style="color: #66cc66;">&#41;</span>; <br />
&nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;setViewerFlashVars&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> options:<span style="color: #0066CC;">Object</span> = <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span>svLoader.<span style="color: #006600;">content</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">embedOptions</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//set gallery.xml url based on current galleryId</span><br />
&nbsp; &nbsp; options.<span style="color: #006600;">galleryURL</span> = galleryURL; &nbsp; &nbsp;<br />
&nbsp; &nbsp; options.<span style="color: #006600;">firstImageIndex</span> = imageIndex;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #808080; font-style: italic;">/**<br />
&nbsp;* Fired when gallery has completly loaded (SWF + &nbsp;XML)<br />
&nbsp;* API is now available.<br />
&nbsp;*/</span> <br />
<span style="color: #000000; font-weight: bold;">function</span> onGalleryLoaded<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; svAPI = <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span>svLoader.<span style="color: #006600;">content</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">api</span>;<br />
&nbsp; &nbsp; svAPI.<span style="color: #006600;">setSize</span><span style="color: #66cc66;">&#40;</span>mcLoader.<span style="color: #006600;">mcFrame</span>.<span style="color: #0066CC;">width</span>,mcLoader.<span style="color: #006600;">mcFrame</span>.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//Init Event Listeners</span><br />
&nbsp; &nbsp; svAPI.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;svImageChange&quot;</span>,updateGalleryUrl<span style="color: #66cc66;">&#41;</span>; &nbsp; <br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #808080; font-style: italic;">//Init Button Click Handlers</span><br />
mcButton1.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>,loadGallery1<span style="color: #66cc66;">&#41;</span>;<br />
mcButton2.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>,loadGallery2<span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #808080; font-style: italic;">//Button Click Handlers</span><br />
<span style="color: #000000; font-weight: bold;">function</span> loadGallery1<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; loadGallery<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;gallery_1&quot;</span>,<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> loadGallery2<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; loadGallery<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;gallery_2&quot;</span>,<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div></td></tr></tbody></table></div>
<p>Save (Crtl + S) simpleviewer_swfaddress.fla.</p>
<p>Export (Crtl + Alt + Shift + S) simpleviewer_swfaddress.fla as simpleviewer_swfaddress.swf into your <strong>gallery</strong> folder.</p>
<p><strong>To test you must upload the files to your server.</strong></p>
<p>Make sure to upload all of the following files and folders:</p>
<ul>
<li>images folder</li>
<li>thumbs folder</li>
<li>gallery_1.xml</li>
<li>gallery_2.xml</li>
<li>index.html</li>
<li>simpleviewer_swfaddress.swf </li>
<li>simpleviewer.swf</li>
<li>swfaddress.js</li>
</ul>
<p>The browser history is updated every time you click a thumbnail, thus enabling the browser back button. You can now link to any image via a nice URL and as you click on thumbnails you can watch the address bar change. You can also directly link to an image.</p>
<p>This code is provided free without guarantee and is &#8220;AS IS&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikerichardsphotography.com/blog/2010/01/28/how-to-simpleviewer-2-and-swfaddress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
