<?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>Warm Forest Flash Blog &#187; navigation</title>
	<atom:link href="http://www.warmforestflash.com/blog/tag/navigation/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.warmforestflash.com/blog</link>
	<description>A blog about Flash &#38; ActionScript 3 from a designer&#039;s perspective</description>
	<lastBuildDate>Thu, 29 Jul 2010 21:20:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Accessible Flash Nav: Right-Click Links to Open in New Window Using AS3</title>
		<link>http://www.warmforestflash.com/blog/2009/07/accessible-flash-nav/</link>
		<comments>http://www.warmforestflash.com/blog/2009/07/accessible-flash-nav/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 23:51:48 +0000</pubDate>
		<dc:creator>warmforest</dc:creator>
				<category><![CDATA[Freebies]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[navigation]]></category>

		<guid isPermaLink="false">http://www.warmforestflash.com/blog/?p=293</guid>
		<description><![CDATA[For a recent project I needed to create a Flash navigation menu for use in a HTML site that functioned as close as possible to a normal HTML nav. In HTML you can right-click links to open them in a new window/tab but normally with Flash menus you can&#8217;t do this. Therefore I had to [...]


Related posts:<ol><li><a href='http://www.warmforestflash.com/blog/2009/06/flash-as3-contact-form-using-php/' rel='bookmark' title='Permanent Link: Flash AS3 Contact Form Using PHP'>Flash AS3 Contact Form Using PHP</a></li>
<li><a href='http://www.warmforestflash.com/blog/2009/04/free-as3-scrollbar-fullscreen-and-resizable/' rel='bookmark' title='Permanent Link: Free AS3 Scrollbar: Fullscreen and Resizable'>Free AS3 Scrollbar: Fullscreen and Resizable</a></li>
<li><a href='http://www.warmforestflash.com/blog/2009/01/as3-dotted-line-class/' rel='bookmark' title='Permanent Link: AS3 Dotted Line Class'>AS3 Dotted Line Class</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>For a recent project I needed to create a Flash navigation menu for use in a HTML site that functioned as close as possible to a normal HTML nav. In HTML you can right-click links to open them in a new window/tab but normally with Flash menus you can&#8217;t do this. Therefore I had to try to create that functionality from scratch with ActionScript.</p>
<p>You can see a working example of what I came up with above in my blog header nav.</p>
<p>Flash links inside of text fields (usually set with CDATA and XML) support right-clicking to open links in new windows by default but setting up a nav that way usually doesn&#8217;t make sense and you would lose a lot of functionality doing it that way. So the trick I found was to take advantage of the fact that you can add a custom right-click context menu not just to the Flash stage but also to each individual sprite itself.</p>
<p>Here is some sample code that you can add to each of your nav items to achieve this:</p>
<div class="geshi no actionscript">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> navItem:Sprite = <span class="kw2">new</span> Sprite<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> cm:<span class="kw3">ContextMenu</span> = <span class="kw2">new</span> <span class="kw3">ContextMenu</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">cm.<span class="kw3">hideBuiltInItems</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> openNewWindow:<span class="kw3">ContextMenuItem</span> = <span class="kw2">new</span> <span class="kw3">ContextMenuItem</span><span class="br0">&#40;</span><span class="st0">&quot;Open Link in New Window&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">openNewWindow.<span class="me1">addEventListener</span><span class="br0">&#40;</span>ContextMenuEvent.<span class="me1">MENU_ITEM_SELECT</span>, onOpenNewWindowSelect, <span class="kw2">false</span>, <span class="nu0">0</span>, <span class="kw2">true</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">cm.<span class="kw3">customItems</span>.<span class="kw3">push</span><span class="br0">&#40;</span>openNewWindow<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">navItem.<span class="kw3">contextMenu</span> = cm;</div>
</li>
</ol>
</div>
<p>I also tried to mimic the browser functionality of command (control on a PC) clicking to open links in new tabs and shift-clicking to open them in new windows. Using keyboard listeners I was able to get this working in Safari but sadly it doesn&#8217;t seem to work at all in Firefox for some reason. In Opera, shift-clicking opens a new tab but command-clicking just triggers the normal right-click menu. I guess it just depends on how the browser wants to handle the keyboard events.</p>
<p>I also added the ability to copy the URL to the clipboard for copying and pasting. Here is a quick snippet of code that will copy text to the system clipboard:</p>
<div class="geshi no actionscript">
<ol>
<li class="li1">
<div class="de1"><span class="kw3">System</span>.<span class="kw3">setClipboard</span><span class="br0">&#40;</span><span class="st0">&quot;Your text to copy&quot;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>So why create a menu in Flash at all if HTML natively supports these features? The main reason would be nice typography &#8211; no more using the same system fonts over and over again. Plus you can create lots of neat dividers/selected state graphics/rollovers without having to open up Photoshop.</p>
<p>Here are three versions of the Flash right-click nav that you can download for free below.</p>
<p><img src="http://www.warmforestflash.com/blog/wp-content/uploads/2009/07/preview_01.gif" alt="TypeNav Font Option 1" /></p>
<p><a href="http://www.warmforestflash.com/products/typenav/free/typenav_font_option_1.zip">&raquo; Download now (zip)</a></p>
<p>&#8211;</p>
<p><img src="http://www.warmforestflash.com/blog/wp-content/uploads/2009/07/preview_06.gif" alt="TypeNav Font Option 6" /></p>
<p><a href="http://www.warmforestflash.com/products/typenav/free/typenav_font_option_6.zip">&raquo; Download now (zip)</a></p>
<p>&#8211;</p>
<p><img src="http://www.warmforestflash.com/blog/wp-content/uploads/2009/07/preview_08.gif" alt="TypeNav Font Option 8" /></p>
<p><a href="http://www.warmforestflash.com/products/typenav/free/typenav_font_option_8.zip">&raquo; Download now (zip)</a></p>
<p>&#8211;</p>
<p><em>For more info, see the <a href="http://www.warmforestflash.com/products/typenav/">TypeNav&#8482; page here</a>.</em></p>
<p>&#8211;</p>


<p>Related posts:<ol><li><a href='http://www.warmforestflash.com/blog/2009/06/flash-as3-contact-form-using-php/' rel='bookmark' title='Permanent Link: Flash AS3 Contact Form Using PHP'>Flash AS3 Contact Form Using PHP</a></li>
<li><a href='http://www.warmforestflash.com/blog/2009/04/free-as3-scrollbar-fullscreen-and-resizable/' rel='bookmark' title='Permanent Link: Free AS3 Scrollbar: Fullscreen and Resizable'>Free AS3 Scrollbar: Fullscreen and Resizable</a></li>
<li><a href='http://www.warmforestflash.com/blog/2009/01/as3-dotted-line-class/' rel='bookmark' title='Permanent Link: AS3 Dotted Line Class'>AS3 Dotted Line Class</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.warmforestflash.com/blog/2009/07/accessible-flash-nav/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
