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

<channel>
	<title>mindnoise.blog</title>
	<atom:link href="http://blog.mindnoise.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mindnoise.net</link>
	<description>Flash, Flex, Air developer's blog</description>
	<pubDate>Tue, 20 May 2008 12:51:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>The Browser’s Back Button in AS3 (Deep Linking). The Flex 3 way.</title>
		<link>http://blog.mindnoise.net/2008/05/the-browser%e2%80%99s-back-button-in-as3-deep-linking-the-flex-3-way/</link>
		<comments>http://blog.mindnoise.net/2008/05/the-browser%e2%80%99s-back-button-in-as3-deep-linking-the-flex-3-way/#comments</comments>
		<pubDate>Tue, 20 May 2008 12:49:23 +0000</pubDate>
		<dc:creator>radu.v.valentin</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<category><![CDATA[browser's back button]]></category>

		<category><![CDATA[mx tags example]]></category>

		<guid isPermaLink="false">http://blog.mindnoise.net/?p=19</guid>
		<description><![CDATA[Introduction.
Fortunately, Flex 3 has full support for deep linking, that means that you can enable the browser&#8217;s back button really easy. The guys from Adobe made 2 classes for this purpose, the HistoryManager class and the BrowserManager class. Both of them are singleton. You cannot use both BrowserManager and HistoryManager in the same application. So [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction.</h2>
<p style="text-indent: 30px; text-align: left;">Fortunately, Flex 3 has full support for deep linking, that means that you can enable the browser&#8217;s back button really easy. The guys from Adobe made 2 classes for this purpose, the <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_8.html" onclick="pageTracker._trackPageview('/outgoing/livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_8.html&referer=');">HistoryManager class</a> and the <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_3.html" onclick="pageTracker._trackPageview('/outgoing/livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_3.html&referer=');">BrowserManager class</a>. Both of them are singleton. You cannot use both BrowserManager and HistoryManager in the same application. So in the next example, we will see how to enable the browser&#8217;s back button in a fast deployed Flex 3 application, using only mx tags and of course the provided history Javascript file.</p>
<h2>Using the browser&#8217;s back button with Flex 3 in a fast deployed application.</h2>
<p style="text-indent: 30px; text-align: left;">In this example we will use the <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_8.html" onclick="pageTracker._trackPageview('/outgoing/livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_8.html&referer=');">HistoryManager class</a>, although it doesn&#8217;t offer us the flexibility that <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_3.html" onclick="pageTracker._trackPageview('/outgoing/livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_3.html&referer=');">BrowserManager class</a> does, it helps us to enable the browser&#8217;s back button really quick using only mx tags.</p>
<p>Ok, first we have to copy in our project folder the Adobe provided history folder. If you use Flex 3 Builder you have to follow the next steps:<br/><br />
   1. Select Project > Properties.<br />
   2. Select the Flex Compiler option.<br />
   3. Select the &#8220;Enable integration with browser navigation&#8221; option.<br/><br />
After that, Flex 3 Builder will copy the history folder in your project folder.<br/><br />
If you use FlexSDK, just copy the history folder located here: (FlexSDK main folder) /templates/client-side-detection-with-history/history to your project folder. The next steps are really easy.<br/><br />
   <strong>Step 1:</strong> Create your mxml file. Here we will create an accordion that changes whenever the browser&#8217;s back button is pressed. Here is the code.</p>
<p>
<div class="wp_codebox_msgheader"><span class="codebox_right"><a href="javascript:;" onclick="toggle_collapse('193');">[<span id="193_symbol">-</span>]</a></span><span class="codebox_left"><span id="l19code3"><a href="javascript:;" onclick="javascript:showCodeTxt('19code3'); return false;">View Code</a> XML</span></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="193"><td class="code" id="19code3"><pre class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="font-weight: bold; color: black;">?&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx:Application</span> <span style="color: #000066;">xmlns:mx</span>=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx:Accordion</span>
		<span style="color: #000066;">historyManagementEnabled</span>=<span style="color: #ff0000;">&quot;true&quot;</span>
		<span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;80%&quot;</span>
		<span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;30%&quot;</span>
		<span style="font-weight: bold; color: black;">&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx:VBox</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Panel 1&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx:TextArea</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">borderColor</span>=<span style="color: #ff0000;">&quot;0xFFFFFF&quot;</span> <span style="color: #000066;">text</span>=<span style="color: #ff0000;">&quot;Some text for the first panel.&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/mx:VBox<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx:VBox</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Panel 2&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx:TextArea</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">borderColor</span>=<span style="color: #ff0000;">&quot;0xFFFFFF&quot;</span> <span style="color: #000066;">text</span>=<span style="color: #ff0000;">&quot;Now here we have some text for the second panel.&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/mx:VBox<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx:VBox</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Panel 3&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx:TextArea</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">borderColor</span>=<span style="color: #ff0000;">&quot;0xFFFFFF&quot;</span> <span style="color: #000066;">text</span>=<span style="color: #ff0000;">&quot;And to finish the things&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/mx:VBox<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/mx:Accordion<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/mx:Application<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre></td></tr></table></div>

</p>
<p style="text-indent: 30px; text-align: left;">The <em>historyManagementEnabled=&#8221;true&#8221;</em> line does all the trick. Now you have an accordion that reacts to browser&#8217;s control. Of course the <em>historyManagementEnabled=&#8221;true&#8221;</em> property is available not only to the accordion container, but also to other containers that have user interaction (like TabNavigator for example). I think this is the easiest way to enable the browser&#8217;s back button.
<p style="text-indent: 30px; text-align: left;"> Ok, now that we have the SWF, we have to place it into a HTML wrapper. The best way to insert a SWF into a HTML is by using <a href="http://blog.deconcept.com/swfobject/" onclick="pageTracker._trackPageview('/outgoing/blog.deconcept.com/swfobject/?referer=');">SWFobject</a>. In your project folder copy the <a href="http://blog.mindnoise.net/tutorials/backbutton/FlashIDE/swfobject/swfobject.js">swfobject.js</a>  into a folder with the same name as the file (swfobject). Here is the HTML code for the wrapper</p>
<p>
<div class="wp_codebox_msgheader"><span class="codebox_right"><a href="javascript:;" onclick="toggle_collapse('194');">[<span id="194_symbol">-</span>]</a></span><span class="codebox_left"><span id="l19code4"><a href="javascript:;" onclick="javascript:showCodeTxt('19code4'); return false;">View Code</a> HTML4STRICT</span></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="194"><td class="code" id="19code4"><pre class="html4strict"><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>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;html</span> xmlns<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;en&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: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;head&gt;</span></span>
&nbsp;
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title&gt;</span></span>Back button example in Flex<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;meta</span> <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><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;history/history.css&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;main.css&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/head&gt;</span></span>
&nbsp;
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;body&gt;</span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flashcontent&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            This content here will be replaced by the SWF.
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;swfobject/swfobject.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;history/history.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		   var so = new SWFObject(&quot;backbutton.swf&quot;, &quot;backbutton&quot;, &quot;100%&quot;, &quot;100%&quot;, &quot;8&quot;, &quot;#CCCCCC&quot;);
		   so.addParam(&quot;allowScriptAccess&quot;, &quot;always&quot;);
		   so.addParam(&quot;swliveconnect&quot;, &quot;true&quot;)
		   so.write(&quot;flashcontent&quot;);
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html&gt;</span></span></pre></td></tr></table></div>

</p>
<p style="text-indent: 30px; text-align: left;">The code simply creates a div with &#8220;flashcontent&#8221; id and puts in it the backbutton.swf (for better understanding please check the <a onclick="pageTracker._trackPageview('/outgoing/blog.deconcept.com/swfobject/_examples?referer=');pageTracker._trackPageview('/outgoing/blog.deconcept.com/swfobject/_examples?referer=http://blog.mindnoise.net/wp-admin/edit.php');pageTracker._trackPageview('/outgoing/blog.deconcept.com/swfobject/_examples?referer=http://blog.mindnoise.net/wp-admin/edit.php');" href="http://blog.deconcept.com/swfobject/#examples" target="_blank">swfobject examples</a>). Don&#8217;t forget to add the <a href="http://blog.mindnoise.net/tutorials/backbutton/FlashIDE/css/main.css" target="_blank">main.css</a> to your project folder for a nice layout. This is it, you have enable the browser&#8217;s back button in your fast deployed application.<br />
<a href="http://blog.mindnoise.net/tutorials/backbutton/Flex/bin/">Here is a working example.</a>
</p>
<p style="text-indent: 30px; text-align: left;">I think that Adobe made a great thing with the <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_8.html" onclick="pageTracker._trackPageview('/outgoing/livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_8.html&referer=');">HistoryManager class</a> and the <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_3.html" onclick="pageTracker._trackPageview('/outgoing/livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_3.html&referer=');">BrowserManager class</a> in Flex, so that standard browser experiences are the same with Flash as they are with HTML. If you have any questions please leave a comment.</p>
<p style="text-indent: 30px; text-align: left;">Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mindnoise.net/2008/05/the-browser%e2%80%99s-back-button-in-as3-deep-linking-the-flex-3-way/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Browser&#8217;s Back Button in AS3 (Deep Linking). The FlashIDE way.</title>
		<link>http://blog.mindnoise.net/2008/05/browser-back-button/</link>
		<comments>http://blog.mindnoise.net/2008/05/browser-back-button/#comments</comments>
		<pubDate>Mon, 12 May 2008 23:29:19 +0000</pubDate>
		<dc:creator>radu.v.valentin</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[AS3]]></category>

		<category><![CDATA[browser back button]]></category>

		<category><![CDATA[Components]]></category>

		<category><![CDATA[deep linking]]></category>

		<category><![CDATA[SWFAddress]]></category>

		<category><![CDATA[SWFObject]]></category>

		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.mindnoise.net/?p=11</guid>
		<description><![CDATA[Introduction.
Breaking standard browser experiences with Flash is an old problem and i&#8217;ve seen that although there are a bunch of tutorials for As2 and some for As3,  using different or same adapted Javascript library there is still a big question mark about this issue.In the past 2 days i&#8217;ve tried to find the best [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction.</h2>
<p style="text-indent: 30px; text-align: left;">Breaking standard browser experiences with Flash is an old problem and i&#8217;ve seen that although there are a bunch of tutorials for As2 and some for As3,  using different or same adapted Javascript library there is still a big question mark about this issue.In the past 2 days i&#8217;ve tried to find the best solution for this problem, I&#8217;ve surf the net and i&#8217;ve found some interesting things. I&#8217;ll try to show you the solutions which i think that are best from most of the aspects. The entire tutorial is written in As3.</p>
<p style="text-indent: 30px; text-align: left;">
<h2>Using the browser&#8217;s back button with Flash.</h2>
<p style="text-indent: 30px; text-align: left;">I&#8217;ve seen many people searching for a so called As3 solution, without javascript. Well, unfortunately , there is no such solution. Imagine the SWF as a guest and the HTML wrapper as a host, you simply can&#8217;t let your guest to give commands in your own house right?  Of course you are polite and give him everything he needs but if he asks kindly. He could ask kindly via Javascript.</p>
<p style="text-indent: 30px; text-align: left;">From all the Javascript libraries for Flash (As3), that help the SWF to ask or give kindly data to browsers, i think the best is SWFAddress. The next example shows how to enable the browser&#8217;s back button using SWFAddress.</p>
<p style="text-indent: 30px; text-align: left;">
<p style="text-indent: 30px; text-align: left;"><strong>Step 1: </strong>Download the latest distribution of <a onclick="pageTracker._trackPageview('/outgoing/blog.deconcept.com/swfobject/?referer=');pageTracker._trackPageview('/outgoing/blog.deconcept.com/swfobject/?referer=http://blog.mindnoise.net/wp-admin/edit.php');pageTracker._trackPageview('/outgoing/blog.deconcept.com/swfobject/?referer=http://blog.mindnoise.net/wp-admin/edit.php');" href="http://blog.deconcept.com/swfobject/" target="_blank">SWFObject</a> and <a onclick="pageTracker._trackPageview('/outgoing/asual.com/swfaddress/?referer=');pageTracker._trackPageview('/outgoing/asual.com/swfaddress/?referer=http://blog.mindnoise.net/wp-admin/edit.php');pageTracker._trackPageview('/outgoing/asual.com/swfaddress/?referer=http://blog.mindnoise.net/wp-admin/edit.php');" href="http://asual.com/swfaddress/" target="_blank">SWFAdress</a>. You can also  download the  <a href="http://blog.mindnoise.net/tutorials/backbutton/FlashIDE/FlashIDE_exemple.zip" target="_blank">FlashIDE example</a> and follow from there the tutorial.</p>
<p style="text-indent: 30px; text-align: left;"><strong>Step 2</strong>: In your project folder (which should be empty right now)  copy the <a href="http://blog.mindnoise.net/tutorials/backbutton/FlashIDE/swfobject/swfobject.js">swfobject.js</a> and <a href="http://blog.mindnoise.net/tutorials/backbutton/FlashIDE/swfaddress/swfaddress.js" target="_blank">swfaddress.js</a> into 2 folders with the same name as the files (swfaddress, swfobject). Next create an index.html that will serve as a wrapper for the swf. Put the next tags into  it.</p>
<p style="text-indent: 30px; text-align: left;">

<div class="wp_codebox_msgheader"><span class="codebox_right"><a href="javascript:;" onclick="toggle_collapse('117');">[<span id="117_symbol">-</span>]</a></span><span class="codebox_left"><span id="l11code7"><a href="javascript:;" onclick="javascript:showCodeTxt('11code7'); return false;">View Code</a> HTML4STRICT</span></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="117"><td class="code" id="11code7"><pre class="html4strict"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flashcontent&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            This content here will be replaced by the SWF.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;swfobject/swfobject.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!--mce:0--&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;swfaddress/swfaddress.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!--mce:1--&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!--mce:2--&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- Google Analytics Plugin is set to ignore your user role --&gt;</span></span></pre></td></tr></table></div>

<p style="text-indent: 30px; text-align: left;">The code simply creates a div with &#8220;flashcontent&#8221; id and puts in it the backbutton.swf (for better understanding please check the <a onclick="pageTracker._trackPageview('/outgoing/blog.deconcept.com/swfobject/_examples?referer=');pageTracker._trackPageview('/outgoing/blog.deconcept.com/swfobject/_examples?referer=http://blog.mindnoise.net/wp-admin/edit.php');pageTracker._trackPageview('/outgoing/blog.deconcept.com/swfobject/_examples?referer=http://blog.mindnoise.net/wp-admin/edit.php');" href="http://blog.deconcept.com/swfobject/#examples" target="_blank">swfobject examples</a>). There are 2 things here that we have to pay attention to. First, the order in which we add the <a href="http://blog.mindnoise.net/tutorials/backbutton/FlashIDE/swfobject/swfobject.js" target="_blank">swfobject.js</a> and <a href="http://blog.mindnoise.net/tutorials/backbutton/FlashIDE/swfaddress/swfaddress.js" target="_blank">swfaddress.js</a>, it will always be first the object and second the address, this is very important. Second, we have to put the Javascript after we create the div because the Javascript uses the div and we don&#8217;t want it to use a null value. Don&#8217;t forget to add the <a href="http://blog.mindnoise.net/tutorials/backbutton/FlashIDE/css/main.css" target="_blank">main.css</a> to the index.html by using the &#8220;link&#8221; tag<br />
Then, add the two AS3 classes from the SWFAddress package(<a href="http://blog.mindnoise.net/tutorials/backbutton/FlashIDE/SWFAddress.as" target="_blank">SWFAddress.as</a> and <a href="http://blog.mindnoise.net/tutorials/backbutton/FlashIDE/SWFAddressEvent.as" target="_blank">SWFAddressEvent.as</a>) to the root directory of your project.</p>
<p style="text-indent: 30px; text-align: left;"><strong>Step3:</strong>Now we have it all set up, the index.html (wrapper), the swfaddress.js, the swfobject.js and the CSS linked to it, and the two SWFAdress class at their place. What we need to do next is to create the SWF, so compile the <a href="http://blog.mindnoise.net/tutorials/backbutton/FlashIDE/backbutton.as" target="_blank">backbutton.as</a> Actionscript code with Flash.(don&#8217;t forget to name the document class &#8220;backbutton&#8221;).</p>
<p>To understand the code you need a basic knowledge in using Flash Components. If you don&#8217;t have it, but you choose to write the code don&#8217;t forget that when you create a new component by code (ex: var cd=new ComboBox)  you need to add the component also in the Library ( Drag and Drop from the Component Panel to Library)</p>
<p style="text-indent: 30px; text-align: left;">

<div class="wp_codebox_msgheader"><span class="codebox_right"><a href="javascript:;" onclick="toggle_collapse('118');">[<span id="118_symbol">-</span>]</a></span><span class="codebox_left"><span id="l11code8"><a href="javascript:;" onclick="javascript:showCodeTxt('11code8'); return false;">View Code</a> ACTIONSCRIPT</span></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="118"><td class="code" id="11code8"><pre class="actionscript">package <span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>;
	<span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">controls</span>.<span style="color: #006600;">ComboBox</span>;
	<span style="color: #0066CC;">import</span> fl.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">DataProvider</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
	<span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">controls</span>.<span style="color: #006600;">TextArea</span>;
	<span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">containers</span>.<span style="color: #006600;">UILoader</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #006600;">URLRequest</span>;
	<span style="color: #0066CC;">import</span> SWFAddress;
	<span style="color: #0066CC;">import</span> SWFAddressEvent;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> backbutton <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> dp:DataProvider = <span style="color: #000000; font-weight: bold;">new</span> DataProvider<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> myCombo = <span style="color: #000000; font-weight: bold;">new</span> ComboBox<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> mytextArea = <span style="color: #000000; font-weight: bold;">new</span> TextArea<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> mySWFAddress=SWFAddress;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> image=<span style="color: #000000; font-weight: bold;">new</span> UILoader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> urlreq=<span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> backbutton<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
			dp.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#123;</span> label:<span style="color: #ff0000;">&quot;Spring&quot;</span> , pictureUrl:<span style="color: #ff0000;">&quot;images/1.jpg&quot;</span> , shortDes:<span style="color: #ff0000;">&quot;We love it!!!&quot;</span><span style="color: #66cc66;">&#125;</span> <span style="color: #66cc66;">&#41;</span>;
			dp.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#123;</span> label:<span style="color: #ff0000;">&quot;Summer&quot;</span> , pictureUrl:<span style="color: #ff0000;">&quot;images/2.jpg&quot;</span> , shortDes:<span style="color: #ff0000;">&quot;Lazy days&quot;</span><span style="color: #66cc66;">&#125;</span> <span style="color: #66cc66;">&#41;</span>;
			dp.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#123;</span> label:<span style="color: #ff0000;">&quot;Winter&quot;</span> , pictureUrl:<span style="color: #ff0000;">&quot;images/3.jpg&quot;</span> , shortDes:<span style="color: #ff0000;">&quot;Is really cold here in Cluj&quot;</span><span style="color: #66cc66;">&#125;</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			myCombo.<span style="color: #006600;">dataProvider</span>=dp;
			myCombo.<span style="color: #006600;">x</span>=<span style="color: #cc66cc;">50</span>;
			myCombo.<span style="color: #006600;">y</span>=<span style="color: #cc66cc;">50</span>;
			addChild<span style="color: #66cc66;">&#40;</span>myCombo<span style="color: #66cc66;">&#41;</span>;
			myCombo.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">CHANGE</span>, onComboBoxChange<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			mytextArea.<span style="color: #0066CC;">width</span> = <span style="color: #cc66cc;">300</span>;
			mytextArea.<span style="color: #0066CC;">height</span> = <span style="color: #cc66cc;">80</span>;
			mytextArea.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">200</span>;
			mytextArea.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">50</span>;
			addChild<span style="color: #66cc66;">&#40;</span>mytextArea<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			image.<span style="color: #006600;">x</span>=<span style="color: #cc66cc;">200</span>;
			image.<span style="color: #006600;">y</span>=<span style="color: #cc66cc;">140</span>;
			image.<span style="color: #006600;">scaleContent</span>=<span style="color: #000000; font-weight: bold;">false</span>;
			addChild<span style="color: #66cc66;">&#40;</span>image<span style="color: #66cc66;">&#41;</span>
&nbsp;
			mySWFAddress.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>SWFAddressEvent.<span style="color: #006600;">CHANGE</span>, onLinkChange<span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onComboBoxChange<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>
			<span style="color: #000000; font-weight: bold;">var</span> newLink = <span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">selectedIndex</span>;
			mySWFAddress.<span style="color: #006600;">setValue</span><span style="color: #66cc66;">&#40;</span>newLink<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onLinkChange<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>
			<span style="color: #000000; font-weight: bold;">var</span> newLink = mySWFAddress.<span style="color: #006600;">getValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			newLink = newLink.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
			mytextArea.<span style="color: #0066CC;">text</span> = dp.<span style="color: #006600;">getItemAt</span><span style="color: #66cc66;">&#40;</span>newLink<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">shortDes</span>;
			urlreq.<span style="color: #0066CC;">url</span>=dp.<span style="color: #006600;">getItemAt</span><span style="color: #66cc66;">&#40;</span>newLink<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">pictureUrl</span>;
			image.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span>urlreq<span style="color: #66cc66;">&#41;</span>;
			mySWFAddress.<span style="color: #006600;">setTitle</span><span style="color: #66cc66;">&#40;</span>dp.<span style="color: #006600;">getItemAt</span><span style="color: #66cc66;">&#40;</span>newLink<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">label</span><span style="color: #66cc66;">&#41;</span>;
			myCombo.<span style="color: #006600;">selectedIndex</span> = newLink;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p style="text-indent: 30px; text-align: left;">So this is it, pay attention to the comments in the <a href="http://blog.mindnoise.net/tutorials/backbutton/FlashIDE/backbutton.as" target="_blank">backbutton.as</a> file to understand how it works. Everything should work just fine. If not, leave a comment, and i will help.<br />
<a href="http://blog.mindnoise.net/tutorials/backbutton/FlashIDE/index.html" target="_blank">Here is a working example.</a><br />
Just choose a item in the ComboBox and then hit the browser&#8217;s back button</p>
<p style="text-indent: 30px; text-align: left;">Well I hope you got the idea, in the second part of the tutorial I&#8217;ll talk a little about how to implement something like this in a large application (best practices, design patterns and all).</p>
<p style="text-indent: 30px; text-align: left;">Have a day nice day!</p>
<p><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mindnoise.net/2008/05/browser-back-button/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
