<?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>GraphNick Design</title>
	<atom:link href="http://graphnickdesign.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://graphnickdesign.com</link>
	<description>Specializing in Web Design, Flash, and Actionscript</description>
	<lastBuildDate>Mon, 31 Oct 2011 19:41:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Designing Jack-o-Lanterns</title>
		<link>http://graphnickdesign.com/blog/designing-halloween/</link>
		<comments>http://graphnickdesign.com/blog/designing-halloween/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 19:26:37 +0000</pubDate>
		<dc:creator>graphnick</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Inspiration]]></category>

		<guid isPermaLink="false">http://graphnickdesign.com/?p=743</guid>
		<description><![CDATA[It has been five years since we had our pumpkin carving extravaganza at work. I was looking at some old pictures from that day back in October of 2006 and remembered the fun Dom Albrecht and I had creating an awesome jack-o-lantern. Here is looking back on that event. Step 1: The Design This was [...]]]></description>
			<content:encoded><![CDATA[<p>It has been five years since we had our pumpkin carving extravaganza at work. I was looking at some old pictures from that day back in October of 2006 and remembered the fun Dom Albrecht and I had creating an awesome jack-o-lantern. Here is looking back on that event.</p>
<p><img src="http://graphnickdesign.com/wp-content/uploads/2011/10/halloween-76.jpg" alt="" title="halloween-76" width="500" height="375" class="aligncenter size-full wp-image-754" /><span id="more-743"></span></p>
<h3>Step 1: The Design</h3>
<p>This was the first time I had ever gone into such depth for designing a pumpkin. I went through the full design-process of conceptualization to production in order to come up with a great creation. Once I had determined what I wanted to create, I rounded up some images into Photoshop in order to fully understand where the design was going to take me. I didn&#8217;t spend too much on the rough, but it did help to get a good idea how to execute the final design.</p>
<p><img src="http://graphnickdesign.com/wp-content/uploads/2011/10/pumpkin.jpg" alt="" title="pumpkin-2006" width="500" height="370" class="aligncenter size-full wp-image-747" /></p>
<h3>Step 2: Materials</h3>
<p>Once I had an idea solidified, it was easy for me to determine what materials I needed to round up to build the pumpkin. I knew I wanted carrots for the hair and a radish for the nose, Dom said he was going to provide the molded teeth, but I was quite certain on some of the finer details until I experimented what was going to work or not. I ended up using partially peeled radishes for the eyes. As it turned out, they were prefect for the job.</p>
<h3>Finalization</h3>
<p>Quite a bit of time was spent on the mouth to make it look just right. The teeth molds that Dom brought in were highly realistic and help give it more life. As I recall, I believe they were molds of his own teeth.</p>
<p>Dom Albrecht deserves much of the props for bringing my concepts to fruition. His air-brushing skills were phenomenal. He had great expertise in face-makeup and is currently a tattoo artist. He brought the realism to the design. We both spend a great deal of time finalizing the details. We added KY-jelly to the mouth to give it more life. In all we had great fun coming up with a memorable jack-o-lantern that gained quite a bit of response from our co-workers.</p>

<a href='http://graphnickdesign.com/blog/designing-halloween/halloween-84/' title='halloween-84'><img width="150" height="150" src="http://graphnickdesign.com/wp-content/uploads/2011/10/halloween-84-150x150.jpg" class="attachment-thumbnail" alt="halloween-84" title="halloween-84" /></a>
<a href='http://graphnickdesign.com/blog/designing-halloween/halloween-83/' title='halloween-83'><img width="150" height="150" src="http://graphnickdesign.com/wp-content/uploads/2011/10/halloween-83-150x150.jpg" class="attachment-thumbnail" alt="halloween-83" title="halloween-83" /></a>
<a href='http://graphnickdesign.com/blog/designing-halloween/halloween-80/' title='halloween-80'><img width="150" height="150" src="http://graphnickdesign.com/wp-content/uploads/2011/10/halloween-80-150x150.jpg" class="attachment-thumbnail" alt="halloween-80" title="halloween-80" /></a>
<a href='http://graphnickdesign.com/blog/designing-halloween/halloween-79/' title='halloween-79'><img width="150" height="150" src="http://graphnickdesign.com/wp-content/uploads/2011/10/halloween-79-150x150.jpg" class="attachment-thumbnail" alt="halloween-79" title="halloween-79" /></a>
<a href='http://graphnickdesign.com/blog/designing-halloween/halloween-76/' title='halloween-76'><img width="150" height="150" src="http://graphnickdesign.com/wp-content/uploads/2011/10/halloween-76-150x150.jpg" class="attachment-thumbnail" alt="halloween-76" title="halloween-76" /></a>
<a href='http://graphnickdesign.com/blog/designing-halloween/pumpkin/' title='pumpkin'><img width="150" height="150" src="http://graphnickdesign.com/wp-content/uploads/2011/10/pumpkin-150x150.jpg" class="attachment-thumbnail" alt="pumpkin" title="pumpkin" /></a>

]]></content:encoded>
			<wfw:commentRss>http://graphnickdesign.com/blog/designing-halloween/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Customizable jQuery Drop-Down Menus</title>
		<link>http://graphnickdesign.com/blog/jquery-dropdown-menus/</link>
		<comments>http://graphnickdesign.com/blog/jquery-dropdown-menus/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 17:17:25 +0000</pubDate>
		<dc:creator>graphnick</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[drop-down]]></category>
		<category><![CDATA[dropdown]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://graphnickdesign.com/?p=704</guid>
		<description><![CDATA[Drop-down menus are standard in websites to easily organize site navigation. By applying a few lines of jQuery and accompanied with some CSS, you can easily create some slick looking menus. A while back I wrote about &#8220;Generating a Dynamic Selection DropDown with jQuery and AJAX.&#8221; For simplicity of that tutorial, I didn&#8217;t focus on [...]]]></description>
			<content:encoded><![CDATA[<p>Drop-down menus are standard in websites to easily organize site navigation. By applying a few lines of jQuery and accompanied with some CSS, you can easily create some slick looking menus. A while back I wrote about &#8220;<a href="http://graphnickdesign.com/?p=256">Generating a Dynamic Selection DropDown with jQuery and AJAX</a>.&#8221; For simplicity of that tutorial, I didn&#8217;t focus on drop-down menus, but you could easily apply the dynamic content driven in that tutorial to the methods explained here.<br />
<span id="more-704"></span>
</p>
<p><a class="demoPage" href="http://graphnickdesign.com/demo/jquery-dropdown/" target="_blank">View the demo</a> to see the functioning drop-down in action to get an idea what I will be explaining.</p>
<h3>Getting Started</h3>
<p>First off, you will need your content marked-up using good semantic standards. It is best practice to use unordered lists for navigation mark-up. I use &#8220;.nav&#8221; class for the base navigation class name and &#8220;.subnav&#8221; for any subsequent-level navigation. I sometimes use an ID rather than a class for the base navigation, but if you wish to reuse the drop-down jQuery for multiple navigation bars on one page, then keeping them more general is beneficial for code reuse.</p>
<h3>The CSS</h3>
<p>You can make the lists look however you please within <a class="demoPage" href="http://graphnickdesign.com/demo/jquery-dropdown/nav.css" target="_blank">the CSS</a>; for simplicity, the design in <a class="demoPage" href="http://graphnickdesign.com/demo/jquery-dropdown/" target="_blank">my tutorial</a> has basic styles applied to it. Positioning is really the key to making your drop-down not only look right, but also function properly as well. My styles use direct selectors in my example, but you may need to use a workaround if you need it to work in older browsers (such as IE). All of the subnav items have an absolute position to pull them out of the regular flow of the document. Every subnav after the first has an additional position offset (<code>left:5em</code>) to push it over from its parent element. It also has a negative margin so that the first item will base-align with its parent. I have also set up &#8220;activeList&#8221; classes that get applied to the list through the jQuery when it has been moused-over (hover), and then removed upon mouse-out.</p>
<h3>Building the jQuery</h3>
<p>Applying the jQuery to the lists to make the drop-downs functional is easier than you might think because of how powerful jQuery is. One of the most important parts about jQuery is understanding how to leverage the power of selector use. Any general selector look-up will apply to all elements found within that selector tree. For example <code>$(".nav li")</code> will search find every and all &#8220;li&#8221; elements within the &#8220;.nav&#8221; class. By using the <code>children()</code> method, jQuery will only select the direct descendants of the parent that will be shown later. </p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="javascript" style="font-family:monospace;">$<span class="br0">&#40;</span><span class="st0">&quot;.nav li&quot;</span><span class="br0">&#41;</span>.<span class="me1">hover</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> <span class="co1">// selects every &quot;li&quot; element found within &quot;.nav&quot;</span>
     <span class="co1">// hover state</span>
<span class="br0">&#125;</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
     <span class="co1">// out state</span>
<span class="br0">&#125;</span><span class="br0">&#41;</span></pre></div></div>
<p>One important part of this jQuery is that it uses setTimeout() to not immediately trigger the <code>slideDown()</code> of the menu so that if the user accidentally rolls away from the menu prematurely, it will not disappear. So, the first thing is to set up a timeout variable and then bind it to the element being hovered over by using the jQuery data method. If timeout exists when hovered over, then the timeout is reset and the subnav will not reset:</p>
<div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdt_2" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_2"></a><a id="wpshat_2" class="wp-synhighlighter-title" href="#codesyntax_2"  onClick="javascript:wpsh_toggleBlock(2)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_2" onClick="javascript:wpsh_code(2)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_2" onClick="javascript:wpsh_print(2)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display: block;"><pre class="javascript" style="font-family:monospace;">...
          <span class="kw2">var</span> timeout <span class="sy0">=</span> $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">data</span><span class="br0">&#40;</span><span class="st0">&quot;timeout&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
          <span class="kw1">if</span><span class="br0">&#40;</span>timeout<span class="br0">&#41;</span> clearTimeout<span class="br0">&#40;</span>timeout<span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>
<p>After the timeout is set the animation in can be set. This can be whatever method you find suitable for your design. I have used slideDown in my example, but there are many ways to bring in your subnavs such as <code>fadeIn()</code>, <code>show()</code>, <code>animate()</code>, to name a few. Once the animation is complete you can trigger an event handler. I add a class to the parent &#8220;li&#8221; to give it separate styling to indicate it is active.</p>
<div id="wpshdo_3" class="wp-synhighlighter-outer"><div id="wpshdt_3" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_3"></a><a id="wpshat_3" class="wp-synhighlighter-title" href="#codesyntax_3"  onClick="javascript:wpsh_toggleBlock(3)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_3" onClick="javascript:wpsh_code(3)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_3" onClick="javascript:wpsh_print(3)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_3" class="wp-synhighlighter-inner" style="display: block;"><pre class="javascript" style="font-family:monospace;">$<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">children</span><span class="br0">&#40;</span><span class="st0">&quot;ul.subnav&quot;</span><span class="br0">&#41;</span>.<span class="me1">slideDown</span><span class="br0">&#40;</span>350<span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
               <span class="co1">// onComplete</span>
               $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">parent</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">addClass</span><span class="br0">&#40;</span><span class="st0">'activeList'</span><span class="br0">&#41;</span>
          <span class="br0">&#125;</span><span class="br0">&#41;</span></pre></div></div>
<p>On the out state of the hover (mouseOut), the timeout data bound to the button is triggered through a <a href="http://api.jquery.com/jQuery.proxy/">proxy</a>. Without a proxy, context of the timeout points to a different object reference and cannot clear the original timeout object. If the timeout isn&#8217;t cleared, then its associated event handler will still trigger whether or not the user&#8217;s cursor slips off and on the intended button. In other words when you roll in and out of a button quickly the timeout never gets reset and the out state event handler may trigger prematurely. So on mouseOut you will see:</p>
<div id="wpshdo_4" class="wp-synhighlighter-outer"><div id="wpshdt_4" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_4"></a><a id="wpshat_4" class="wp-synhighlighter-title" href="#codesyntax_4"  onClick="javascript:wpsh_toggleBlock(4)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_4" onClick="javascript:wpsh_code(4)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_4" onClick="javascript:wpsh_print(4)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_4" class="wp-synhighlighter-inner" style="display: block;"><pre class="javascript" style="font-family:monospace;">...
          <span class="co1">// out state</span>
          $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">data</span><span class="br0">&#40;</span><span class="st0">&quot;timeout&quot;</span><span class="sy0">,</span> setTimeout<span class="br0">&#40;</span>$.<span class="me1">proxy</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
                 <span class="co1">// animate out</span>
          <span class="br0">&#125;</span><span class="sy0">,</span> <span class="kw1">this</span><span class="br0">&#41;</span><span class="sy0">,</span> 300<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// timeout set for 300 milliseconds</span></pre></div></div>
<p>Once the proxy triggers its event handler, the animation out will occur. Again, the animation here can be set to the desired design for the site. I have used <code>slideUp()</code>, but you can play with other ways to animate it out. Once the animation is complete, you can trigger another handler to remove the activeList class that was placed there previously.</p>
<div id="wpshdo_5" class="wp-synhighlighter-outer"><div id="wpshdt_5" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_5"></a><a id="wpshat_5" class="wp-synhighlighter-title" href="#codesyntax_5"  onClick="javascript:wpsh_toggleBlock(5)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_5" onClick="javascript:wpsh_code(5)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_5" onClick="javascript:wpsh_print(5)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_5" class="wp-synhighlighter-inner" style="display: block;"><pre class="javascript" style="font-family:monospace;">$<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">children</span><span class="br0">&#40;</span><span class="st0">&quot;ul.subnav&quot;</span><span class="br0">&#41;</span>.<span class="me1">slideUp</span><span class="br0">&#40;</span>200<span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
  <span class="co1">// onComplete</span>
  $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">parent</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">removeClass</span><span class="br0">&#40;</span><span class="st0">'activeList'</span><span class="br0">&#41;</span>
<span class="br0">&#125;</span><span class="br0">&#41;</span></pre></div></div>
<p>Here is the code in it&#8217;s entirety that I keep in a separate .js file:</p>
<div id="wpshdo_6" class="wp-synhighlighter-outer"><div id="wpshdt_6" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_6"></a><a id="wpshat_6" class="wp-synhighlighter-title" href="#codesyntax_6"  onClick="javascript:wpsh_toggleBlock(6)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_6" onClick="javascript:wpsh_code(6)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_6" onClick="javascript:wpsh_print(6)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_6" class="wp-synhighlighter-inner" style="display: block;"><pre class="javascript" style="font-family:monospace;"><span class="co1">// JavaScript Document</span>
<span class="kw2">function</span> setDropDown<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
	$<span class="br0">&#40;</span><span class="st0">&quot;.nav li&quot;</span><span class="br0">&#41;</span>.<span class="me1">hover</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
		<span class="kw2">var</span> timeout <span class="sy0">=</span> $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">data</span><span class="br0">&#40;</span><span class="st0">&quot;timeout&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="kw1">if</span><span class="br0">&#40;</span>timeout<span class="br0">&#41;</span> clearTimeout<span class="br0">&#40;</span>timeout<span class="br0">&#41;</span><span class="sy0">;</span>
		$<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">children</span><span class="br0">&#40;</span><span class="st0">&quot;ul.subnav&quot;</span><span class="br0">&#41;</span>.<span class="me1">slideDown</span><span class="br0">&#40;</span>350<span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
			<span class="co1">// onComplete</span>
			$<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">parent</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">addClass</span><span class="br0">&#40;</span><span class="st0">'activeList'</span><span class="br0">&#41;</span>
		<span class="br0">&#125;</span><span class="br0">&#41;</span>
	<span class="br0">&#125;</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
		<span class="co1">// out state</span>
		$<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">data</span><span class="br0">&#40;</span><span class="st0">&quot;timeout&quot;</span><span class="sy0">,</span> setTimeout<span class="br0">&#40;</span>$.<span class="me1">proxy</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
			$<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">children</span><span class="br0">&#40;</span><span class="st0">&quot;ul.subnav&quot;</span><span class="br0">&#41;</span>.<span class="me1">slideUp</span><span class="br0">&#40;</span>200<span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
				<span class="co1">// onComplete</span>
				$<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">parent</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">removeClass</span><span class="br0">&#40;</span><span class="st0">'activeList'</span><span class="br0">&#41;</span>
			<span class="br0">&#125;</span><span class="br0">&#41;</span>
		<span class="br0">&#125;</span><span class="sy0">,</span> <span class="kw1">this</span><span class="br0">&#41;</span><span class="sy0">,</span> 300<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">//timeout set for 300 milliseconds</span>
	<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>
<h3>Endless Possibilities</h3>
<p><a class="demoPage" href="http://graphnickdesign.com/demo/jquery-dropdown/" target="_blank">There you go.</a> In just a few lines of code, you can easily implement a drop-down menu that will work with an infinite number of subnav elements you have nested within your navigation. Now it is your turn to give it a try. There are endless design possibilities once you figure the basics of implementing the code. Hopefully I have broken it down enough to make more sense of it. If you have any questions, please feel free to leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://graphnickdesign.com/blog/jquery-dropdown-menus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Four Key Steps to Better Design</title>
		<link>http://graphnickdesign.com/blog/key-steps-design/</link>
		<comments>http://graphnickdesign.com/blog/key-steps-design/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 05:10:13 +0000</pubDate>
		<dc:creator>graphnick</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Inspiration]]></category>
		<category><![CDATA[brand]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[inspiration]]></category>
		<category><![CDATA[research]]></category>

		<guid isPermaLink="false">http://graphnickdesign.com/?p=661</guid>
		<description><![CDATA[We have all run into that project where the design gets so rushed that important steps to establish a great design get forgotten. Many clients undervalue the amount of necessary research it takes before the pencil even hits the sketchpad. The better we are with research, listening, and communicating, the better our designs will be; [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_668" class="wp-caption alignleft" style="width: 410px"><img class="size-full wp-image-668" title="Design Research by Nick Haroldsen" src="http://graphnickdesign.com/wp-content/uploads/2011/06/design_research.jpg" alt="" width="400" height="300" /><p class="wp-caption-text">Photo by Nick Haroldsen</p></div>
<p>We have all run into that project where the design gets so rushed that important steps to establish a great design get forgotten. Many clients undervalue the amount of necessary research it takes before the pencil even hits the sketchpad. The better we are with research, listening, and communicating, the better our designs will be; ultimately, giving more value to our work.<span id="more-661"></span></p>
<p>Most of the work I do is involved with creating/developing designs for companies with a relatively established brand. Designing for a new brand has similar design processes, but here I will focus mainly on research and designing for established brands. These four steps are key to creating a better design:</p>
<ol>
<li><a href="#1">Research the Brand</a></li>
<li><a href="#2">Research the Audience</a></li>
<li><a href="#3">Thorough Listening</a></li>
<li><a href="#4">Communicating the Design</a></li>
</ol>
<h3>Research the Brand<a name="1"></a></h3>
<p>I know I&#8217;ve been guilty of assuming that I know what the client wants before doing the proper research. I have caught myself needing to take a step back before jumping right into the design mode of the project. Without proper and thorough research, you will never discover the necessary things to not only make the design work aesthetically, but also enhance the user&#8217;s experience.</p>
<p>One time I was handed a design from a client who essentially said, &#8220;We need to save on cost, so will you please take our branding guidelines and this design (that the HR person threw together) and create a site for us?&#8221; When I first looked at the design, I could tell someone who didn&#8217;t understand good design put the layout together. I then proceeded to do some research on the client and their branding guidelines. The client didn&#8217;t even follow their own branding guidelines.  Within the guidelines were specific standards on grids used for their website, it also contained strict color and imagery usage on the page; simple things were missed because someone didn&#8217;t take the time to research their own brand.</p>
<p>You will hear many times, &#8220;Think outside the box,&#8221; but in order to do that, one must first understand the box.  The rudimentary rules of an established brand cannot be ignored.  In order to understand the brand, it is important to do the necessary research: dig through annual-reports; learn the corporate values, mission, etc. Discover who the company is and what they represent. It is thorough research and understanding the minute details of the company that will help translate the communication across the campaign.</p>
<h3><a name="2"></a>Research the Audience</h3>
<p>Beyond searching through the branding guidelines, thorough research needs to be made on the corporate culture and clients. Learning about the clients and/or intended audience is essential to understanding the voice or tone to be communicated. It is important to keep the user&#8217;s experience (UX) in mind. Many articles are written on UX and catering to the needs of the intended audience. Discover and understand what works best for the intended user. If you don&#8217;t understand who will be using the site, viewing your collateral, or whatever, then you will not be able to cater to their needs nor speak on their level and fall flat in the design.</p>
<h3><a name="3"></a>Thorough Listening</h3>
<p>Research includes verbal discussions with people at the company. It is helpful that sound research on the company has been done prior to the discussion with company personnel. Having a good background on the company can lead to a more productive discussion on branding specifics and company culture. I have foolishly gone into meetings where no research on the company was made prior to the meeting. Many of the questions that were asked were branding questions that could have easily been found in their branding guideline manual. It was difficult to know what questions to even ask and it made us look and feel clueless and unprofessional.</p>
<p>When discussing project details with the client, it is essential that you really listen. At times the client may not be able to verbalize what they want. Other times they may be overly specific on what they want, but you know that their direction either will not work esthetically, or will not fit well with their brand nor communicate well to their audience. As you are sensitive to their feedback and utilize your expertise to deliver design that fits their brand, you will discover ways that will propel the design to greater levels than neither you nor the client could have originally conceptualized.</p>
<h3><a name="4"></a>Communicating Your Design</h3>
<p>Once all essential information is gathered through intense research, the design becomes much more natural. It shouldn&#8217;t feel forced or awkward since it is playing off of what has already been established and discussed in the research stage. Certain aspects of your designs may need explained as to how/why certain decisions were made; other times the designs will speak for itself as it fits well within their brand and/or messaging campaign. If you cannot communicate why certain things function or work better the way it was designed to, then you do not understand the brand or the goals behind the campaign. This lack of understanding can lead to uninformed decisions, which will ultimately stifle the design and even your credibility.</p>
<p>Most clients that I have come across appreciate my expertise, especially when I am able to confidently communicate with them how and why design decisions were made, how it matches their brand and goals, and how it will speak to their audience to reinforce their company brand. There is no better feeling when communicating with the client about the design, as when they say, &#8220;You really know us. You hit it right on the head.</p>
<h3>Conclusion</h3>
<p>We must take the time to understand the client and their needs. The key to successful design isn&#8217;t simply in the thumb-nailing, drafting, or production stage; I have found that great design is preceded by having a good understanding about all aspects of the company the design is communicating for.</p>
]]></content:encoded>
			<wfw:commentRss>http://graphnickdesign.com/blog/key-steps-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Printing Content Within Flash</title>
		<link>http://graphnickdesign.com/blog/print-flash-content/</link>
		<comments>http://graphnickdesign.com/blog/print-flash-content/#comments</comments>
		<pubDate>Mon, 16 May 2011 23:01:53 +0000</pubDate>
		<dc:creator>graphnick</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[printing]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://graphnickdesign.com/?p=637</guid>
		<description><![CDATA[Recently, I was given the challenge to make Flash in an eCard printable in all browsers through the HTML. The thing about printing an HTML page with Flash is that the default on all browsers is to suppress printout on background images as well as Flash Objects. The challenge was that both content from the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://graphnickdesign.com/demo/ebutton_print/"><img src="http://graphnickdesign.com/wp-content/uploads/2011/05/eCard.jpg" alt="" title="eCard" width="246" height="184" class="alignleft size-full wp-image-650" /></a>Recently, I was given the challenge to make <a href="http://graphnickdesign.com/demo/ebutton_print/">Flash in an eCard</a> printable in all browsers through the HTML. The thing about printing an HTML page with Flash is that the default on all browsers is to suppress printout on background images as well as Flash Objects. The challenge was that both content from the HTML page and Flash content needed to print. The solution I came up with was to push all desired printed content into Flash and utilize Flash&#8217;s PrintJob Object. <span id="more-637"></span></p>
<h3>Passing the Parameters to Flash</h3>
<p>In my last post I already went into &#8220;<a href="http://graphnickdesign.com/blog/javascript-communicate-flash/trackback/">Using JavaScript to Communicate With Flash&#8221;</a>, so I will not go into detail here. Basically, the HTML data/content can be passed into the Flash by calling a Flash method with JavaScript with the desired parameters passed through. Once the desired content is passed into the Flash through the Flash method call, all the print setup work  done through the Flash.</p>
<h3>Printing With Flash</h3>
<p>Printing within Flash is pretty straight forward. First, create a Sprite that will hold your printed content with the <span class="emphasis2">desired</span> dimensions, design, and layout. I find that I typically don&#8217;t want to mess with the he original Flash content if it must keep its display on the screen the way it is currently displaying. However, the content may need to display slightly differently on the printed page that it does on the screen. I have found that either the original Flash movie must be cloned, reloaded, or captured as a Bitmap and passed into a printPage sprite. </p>
<p>Capturing the Flash content as a bitmap is one way to get the current state of the animation without having to reload any of the animation or other content if your movie is complex. However, by using a bitmap, you will lose the vector qualities Flash can bring and will pixelate your final print output. One way I found to increase the quality of a vector-to-bitmap graphic is to double the size of the vector movieclip <span class="emphasis1">before</span> capturing the bitmap of the displayObject, and then reducing the size of the bitmap, will give you more pixels to print from, thus increasing your print quality. Capturing a bitmap may not be necessary; If the display object is simple enough to add straight to the print sheet, then do it as it will retain all vectors that will print much more cleanly.</p>
<p>Once you have the content for your <span class="emphasis3">print-job</span> laid out the way you want, pass that Sprite into your PrintJob object. The PrintJob object will handle all the work for you. The challenging part is handling the page if it goes beyond the printable space. Either you must truncate the content or loop through the content to create new Sprites for each new page that needs to print. With my example, the content was intended for a single page, but at times the content stretched beyond the printable area, I was then forced to truncate some of the text if it went beyond the limits of the page. The other option was to decrease the font size until it fit, but we decided on the former solution for this project to keep all text sizes consistent.</p>
<p><span class="emphasis2">Another consideration</span> when printing is accounting for landscape vs vertical layout the user can select when printing. You may need additional logic to change the layout to fit the content differently according to what gets selected:</p>
<div id="wpshdo_7" class="wp-synhighlighter-outer"><div id="wpshdt_7" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_7"></a><a id="wpshat_7" class="wp-synhighlighter-title" href="#codesyntax_7"  onClick="javascript:wpsh_toggleBlock(7)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_7" onClick="javascript:wpsh_code(7)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_7" onClick="javascript:wpsh_print(7)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_7" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw1">if</span> <span class="br0">&#40;</span>myPrintJob<span class="sy0">.</span><span class="kw7">start</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
	<span class="kw2">var</span> mw<span class="sy0">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span class="kw5">Number</span></a><span class="sy0">;</span>
	<span class="kw2">var</span> mh<span class="sy0">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span class="kw5">Number</span></a><span class="sy0">;</span>
	<span class="kw1">if</span> <span class="br0">&#40;</span>myPrintJob<span class="sy0">.</span><span class="kw7">orientation</span>==<span class="st0">&quot;portrait&quot;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
		mw=MAX_WIDTH <span class="co1">//</span>
		<span class="co1">// do something</span>
	<span class="br0">&#125;</span><span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>myPrintJob<span class="sy0">.</span><span class="kw7">orientation</span>==<span class="st0">&quot;landscape&quot;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
		mh=MAX_WIDTH<span class="sy0">;</span> <span class="co1">// mh becomes the MAX_WIDTH;</span>
		mw=MAX_HEIGHT <span class="co1">// mw becomes the MAX_HEIGHT;</span>
		<span class="co1">// do something else</span>
	<span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div>
<h3>Handling Multiple Pages</h3>
<p>Perhaps you need to print multiple pages. Lets say you have a Flash gallery that you want to print every item and description in a format that is suitable for viewing on a printed page. This may mean that the format for the print-job is different from what is seen on the screen. The best way I have found to do this is to loop through all the items and basically recreate the pages for print. This means reloading images and adding them to a new page. If the content goes beyond the maxHeight of the page, then you create a new sprite to push that content to. Here is some sample code that does this:<br />
<div id="wpshdo_8" class="wp-synhighlighter-outer"><div id="wpshdt_8" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_8"></a><a id="wpshat_8" class="wp-synhighlighter-title" href="#codesyntax_8"  onClick="javascript:wpsh_toggleBlock(8)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_8" onClick="javascript:wpsh_code(8)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_8" onClick="javascript:wpsh_print(8)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_8" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><span class="sy0">...</span>
<span class="co1">// within loop</span>
<span class="kw1">if</span> <span class="br0">&#40;</span>image_mc<span class="sy0">.</span><span class="kw7">y</span> <span class="sy0">+</span> image_mc<span class="sy0">.</span>height<span class="sy0">&gt;</span>MAX_HEIGHT<span class="sy0">-</span>image_mc<span class="sy0">.</span><span class="kw7">height</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
	_sheetIndex<span class="sy0">++;</span>
	startY= <span class="nu0">25</span><span class="sy0">;</span>
	_sheet = <span class="kw1">new</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span class="kw5">Sprite</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="kw7">addChild</span><span class="br0">&#40;</span>_sheet<span class="br0">&#41;</span>
	_pagesToPrint_array<span class="sy0">.</span><span class="kw7">push</span><span class="br0">&#40;</span>_sheet<span class="br0">&#41;</span>
<span class="br0">&#125;</span>
_sheet<span class="sy0">.</span><span class="kw7">addChild</span><span class="br0">&#40;</span>image_mc<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw1">if</span> <span class="br0">&#40;</span>curIndex<span class="sy0">&gt;</span>=imagesLength<span class="br0">&#41;</span><span class="br0">&#123;</span>
	printSheet<span class="br0">&#40;</span><span class="br0">&#41;</span>
<span class="br0">&#125;</span>
<span class="kw1">private</span> <span class="kw3">function</span> printSheet<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span><span class="br0">&#123;</span>
	<span class="kw2">var</span> pl<span class="sy0">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span class="kw5">int</span></a> = _pagesToPrint_array<span class="sy0">.</span><span class="kw7">length</span><span class="sy0">;</span>
	<span class="kw1">if</span> <span class="br0">&#40;</span>myPrintJob<span class="sy0">.</span><span class="kw7">start</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
		<span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> v=<span class="nu0">0</span><span class="sy0">;</span> v<span class="sy0">&lt;</span>pl<span class="sy0">;</span> v<span class="sy0">++</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
			myPrintJob<span class="sy0">.</span><span class="kw7">addPage</span><span class="br0">&#40;</span>_pagesToPrint_array<span class="br0">&#91;</span>v<span class="br0">&#93;</span><span class="sy0">,</span> <span class="kw1">null</span><span class="sy0">,</span> <span class="kw1">null</span><span class="sy0">,</span> 1<span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="br0">&#125;</span>
		myPrintJob = <span class="kw1">null</span><span class="sy0">;</span>
		removeAll<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="co1">// clear all _sheet(s) once printed</span>
	<span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div>  </p>
<p>If you have quite a bit of content that needs created for the printed sheets, it will take a bit of time to compile the job. It is a good idea to have a dialogue to tell the user it is compiling the print. I have found it useful when printing multiple pages with many images that need loaded.</p>
<p>Below is a <a href="http://graphnickdesign.com/demo/octanner/milestones/awards.html#5">good example</a> of a gallery I developed that prints the items. Note that the print button is in HTML that passes to the Flash with JavaScript. All the images are reloaded into holder sprites when printed and then disposed of once the print is complete.
<p><a href="http://graphnickdesign.com/demo/octanner/milestones/awards.html#5"><img src="http://graphnickdesign.com/wp-content/uploads/2011/05/print-flash-gallery.jpg" alt="Printing a Flash Gallery" title="How to Print a Flash Gallery Example" width="500" height="370" class="aligncenter size-full wp-image-647" /></a></p>
<h3>Conclusion</h3>
<p>There may be other solutions that could work, but this customized solution gave me the control that I needed to output the content in the desired fashion with direct control over the elements. Printing a page within the Flash environment works well and gives you greater control than simply printing through the browser.</p>
]]></content:encoded>
			<wfw:commentRss>http://graphnickdesign.com/blog/print-flash-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using JavaScript to Communicate With Flash</title>
		<link>http://graphnickdesign.com/blog/javascript-communicate-flash/</link>
		<comments>http://graphnickdesign.com/blog/javascript-communicate-flash/#comments</comments>
		<pubDate>Mon, 25 Apr 2011 20:37:17 +0000</pubDate>
		<dc:creator>graphnick</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://graphnickdesign.com/?p=584</guid>
		<description><![CDATA[Lately I have been working on this project that requires JavaScript to communicate with the Flash on the page. It is something that I have done in the past, but this time I was running into issues that were giving me problems. Sometimes the issues were in all browsers, but many times the errors were [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://graphnickdesign.com/wp-content/uploads/2011/04/js_flash.jpg" alt="JavaScript to Flash" title="javascript_to_flash" class="aligncenter size-full wp-image-626" /></p>
<p>Lately I have been working on this project that requires JavaScript to communicate with the Flash on the page. It is something that I have done in the past, but this time I was running into issues that were giving me problems. Sometimes the issues were in all browsers, but many times the errors were only showing up in Internet Explorer. Here I will go through the steps to properly set up your Flash and JavaScript and explain a couple ways to avoid seemingly erroneous errors so communication between the to can take place. <span id="more-584"></span></p>
<h3>Interact With the Example</h3>
<p>Test it out for yourself below to discover the capabilities of communicating back and forth between Flash and JavaScript, or <a href="http://graphnickdesign.com/demo/externalinterface/" target="_blank">launch example in a new page</a>. Further explanation is given further below.</p>
<p style="margin-bottom:0">Input HTML text in the box below:</p>
<div id="flashExample">
<p><script>
function sendToFlash(val){
	$j = jQuery.noConflict()
	var flash = $j('#flashExample').children('object').attr('name');
	getFlashMovie(flash).setFlashText(val)
}
function getFlashMovie(movieName){
	var isIE = navigator.appName.indexOf("Microsoft") != -1;   
	return (isIE) ? window[movieName] : document[movieName];  
}
function getFlashText(str){
	document.getElementById('fromFlash').innerHTML=str
}
</script></p>
<form name="toFlash" >
		<textarea name="textToFlash" width="375px" height="300px" cols="45" rows="4"></textarea></p>
<p style="margin:0 0 10px 0">
<input name="submit" type="button" value="Send Text To Flash Below" onclick="sendToFlash(this.form.textToFlash.value)"  />
</form>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_externalinterface_1212391974"
			class="flashmovie"
			width="375"
			height="300">
	<param name="movie" value="http://graphnickdesign.com/demo/swf/externalinterface.swf" />
	<param name="scale" value="noscale" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://graphnickdesign.com/demo/swf/externalinterface.swf"
			name="fm_externalinterface_1212391974"
			width="375"
			height="300">
		<param name="scale" value="noscale" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<h4 style="color:#333">Text From Flash (this is HTML)</h4>
<p id="fromFlash" style="display: block; border:1px solid #666666; color:#cccccc; padding:10px; margin-top:0; width:375px">&nbsp;</p>
</div>
<h3>Setting Up the Flash</h3>
<p>If you are using an external class, the package for ExternalInterface is <code>import flash.external.ExternalInterface;</code> To send a call from Flash to Javascript, use <code>ExternalInterface.call('jsFunction', params)</code>. Calling a Flash method from Javascript requires a registration of the method through <code>ExternalInterface.addCallback('jsCallerFunction', flashFunctionName)</code>. Registration of the method can take place at any time, but needs to be registered before the user has access to it from within the JavaScript. It is a good idea to check to ensure the ExternalInterface is available before running such functions as well as use catch exceptions to avoid any uncaught errors:</p>
<div id="wpshdo_9" class="wp-synhighlighter-outer"><div id="wpshdt_9" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_9"></a><a id="wpshat_9" class="wp-synhighlighter-title" href="#codesyntax_9"  onClick="javascript:wpsh_toggleBlock(9)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_9" onClick="javascript:wpsh_code(9)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_9" onClick="javascript:wpsh_print(9)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_9" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript" style="font-family:monospace;"><span class="kw1">if</span> <span class="br0">&#40;</span>ExternalInterface.<span class="me1">available</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
	<span class="kw3">try</span><span class="br0">&#123;</span>
		ExternalInterface.<span class="me1">addCallback</span><span class="br0">&#40;</span><span class="st0">'setFlashText'</span>, setText<span class="br0">&#41;</span>;
		<span class="co1">//ExternalInterface.call(&quot;printCard&quot;);</span>
	<span class="br0">&#125;</span><span class="kw3">catch</span> <span class="br0">&#40;</span><span class="kw3">error</span>:<span class="kw3">Error</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
		<span class="co1">//trace(error)</span>
	<span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div>
<h3>Setting Up the JavaScript</h3>
<p>The best way to set up your Flash Object on your page so that all browsers read it the same is through SWFObject. If you code your object directly, the Flash method set up in the Flash through the ExternalInterface may not get registered properly and therefore not available for use in IE. There are other scripts out there that help with this issue, but I have found that SWFObject works the best and is now standard use.
<p>Since IE views the Flash Object differently from other browsers, it is necessary to do a bit of logic when referencing the SWF to call the desired Actionscript method:</p>
<div id="wpshdo_10" class="wp-synhighlighter-outer"><div id="wpshdt_10" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_10"></a><a id="wpshat_10" class="wp-synhighlighter-title" href="#codesyntax_10"  onClick="javascript:wpsh_toggleBlock(10)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_10" onClick="javascript:wpsh_code(10)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_10" onClick="javascript:wpsh_print(10)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_10" class="wp-synhighlighter-inner" style="display: block;"><pre class="javascript" style="font-family:monospace;"><span class="kw2">function</span> getFlashMovie<span class="br0">&#40;</span>movieName<span class="br0">&#41;</span><span class="br0">&#123;</span>
	<span class="kw2">var</span> isIE <span class="sy0">=</span> navigator.<span class="me1">appName</span>.<span class="me1">indexOf</span><span class="br0">&#40;</span><span class="st0">&quot;Microsoft&quot;</span><span class="br0">&#41;</span> <span class="sy0">!=</span> <span class="sy0">-</span><span class="nu0">1</span><span class="sy0">;</span>
	<span class="kw1">return</span> <span class="br0">&#40;</span>isIE<span class="br0">&#41;</span> <span class="sy0">?</span> window<span class="br0">&#91;</span>movieName<span class="br0">&#93;</span> <span class="sy0">:</span> document<span class="br0">&#91;</span>movieName<span class="br0">&#93;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>
<p>Once that is ready you can call your ActionScript by using the name of the SWF object used:</p>
<div id="wpshdo_11" class="wp-synhighlighter-outer"><div id="wpshdt_11" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_11"></a><a id="wpshat_11" class="wp-synhighlighter-title" href="#codesyntax_11"  onClick="javascript:wpsh_toggleBlock(11)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_11" onClick="javascript:wpsh_code(11)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_11" onClick="javascript:wpsh_print(11)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_11" class="wp-synhighlighter-inner" style="display: block;"><pre class="javascript" style="font-family:monospace;"><span class="sy0">&lt;</span>code<span class="sy0">&gt;</span>
<span class="kw2">function</span> sendToFlash<span class="br0">&#40;</span>val<span class="br0">&#41;</span><span class="br0">&#123;</span>
	getFlashMovie<span class="br0">&#40;</span><span class="st0">'jsFlash'</span><span class="br0">&#41;</span>.<span class="me1">setFlashText</span><span class="br0">&#40;</span><span class="br0">&#41;</span>
<span class="br0">&#125;</span>
<span class="sy0">&lt;/</span>code<span class="sy0">&gt;</span>
<span class="sy0">&lt;</span>input <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;submit&quot;</span> type<span class="sy0">=</span><span class="st0">&quot;button&quot;</span> value<span class="sy0">=</span><span class="st0">&quot;Send Text To Flash Below&quot;</span> onclick<span class="sy0">=</span><span class="st0">&quot;sendToFlash(this.form.textToFlash.value)&quot;</span>  <span class="sy0">/&gt;</span></pre></div></div>
<h3>Call JavaScript From Flash</h3>
<p>This call is even simpler than the previous as it requires less to reference the script. It is directly accessed by using <code>ExternalInterface.call("jsFunction", params)</code>. Where &#8220;jsFunction&#8221; is the string name of the JavaScript method to be called. As long as the jsFunction method is set up somewhere within your JavaScript, it is easily accessed.<br />
<h3>Avoiding Pitfalls</h3>
<p>There are a couple things I have found that can cause you major head when trying to communicate with the Flash through JavaScript. </p>
<ol>
<li>First, IE will not allow the Flash to be nested within any &lt;form&gt; tags. This is a known issue with Adobe and can be a pain to workaround if your SWF needs to be nested within a form. If the form can go outside the SWF Object, then do it, otherwise IE will give you errors when you call the Flash Method from the JavasScript saying it is not available.</li>
<li>There are certain sandbox security issues when dealing with ExternalInterface to stop malicious scripting. This means that in order to test these methods out may (however not always) require posting on an external server to pass values to and from Flash.</li>
<li>One other issue that I have run into occurs when passing parameters/arguments to the Flash; make sure they are valid parameters that are available in the registered Flash&#8217;s method. If the parameters are null or invalid, your Flash will throw an error and may be difficult to track down. This may go without saying, however, this has happened to me where I was thinking the Flash wasn&#8217;t registering method through the ExternalInterface class, when it was simply a bad parameter that I was passing through and the DOM didn&#8217;t know what to do with it.</li>
</ol>
<h3>Conclusion</h3>
<p>Communication with Flash through JavaScript is highly useful and can done easily if you understand the capabilities and limitations. If you have any questions about its use, please feel free to leave a comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://graphnickdesign.com/blog/javascript-communicate-flash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Experiment with a Simple jQuery/CSS Clock</title>
		<link>http://graphnickdesign.com/blog/experiment-jquery-clock/</link>
		<comments>http://graphnickdesign.com/blog/experiment-jquery-clock/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 21:09:41 +0000</pubDate>
		<dc:creator>graphnick</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://graphnickdesign.com/?p=527</guid>
		<description><![CDATA[It may seem a bit of a basic experiment, but I thought I would experiment a bit with jQuery and create a simple clock. The concept is basic, but understanding the basics can lead to even greater discoveries. This jQuery sets the angle of the &#8220;moz&#8221; properties in the CSS, so it is not available [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://graphnickdesign.com/wp-content/uploads/2011/03/jquery_clock.gif" alt="" title="jquery_clock" width="150" height="149" class="aligncenter size-full wp-image-629" /> It may seem a bit of a basic experiment, but I thought I would experiment a bit with jQuery and create a simple clock. The concept is basic, but understanding the basics can lead to even greater discoveries. <span id="more-527"></span> This jQuery sets the angle of the &#8220;moz&#8221; properties in the CSS, so it is not available in IE. Perhaps there is another solution, but this is my experiment with the <a href="http://plugins.jquery.com/plugin-tags/rotate">rotate plugin</a>.</p>
<div id="clockHolder">
<div id="curTime">
</div>
<div id="clock">
<div id="hour"><img src="http://graphnickdesign.com/demo/images/clock_hour.png"/></div>
<div id="minute"><img src="http://graphnickdesign.com/demo/images/clock_minute.png"/></div>
<div id="second"><img src="http://graphnickdesign.com/demo/images/clock_second.png"/></div>
</div>
</div>
<p>This clock contains four images, one GIF for the background graphics and three transparent PNG&#8217;s for the hour, minute, and second hands where the rotation point is exactly in the center of the graphic. The position for the CSS was placed so all the images stack directly on top of one another. It then uses a <code>setInterval</code> to check the time every second and rotate the hands accordingly. The logic simply breaks down the angle the hand needs to be. Since there 360&deg; in a circle, and 60 seconds within that circle, the math is as easy as 360/60*t. Hours get multiplied five times what the seconds and minutes get since the hour sits on every fifth interval of the minute (or second) angle.</p>
<p>Sure, this is not breakthrough programming. It was simply good for me to demonstrate the ease that jQuery makes rotating an image with very little code. It uses a simple jQuery plugin to simplify the process. Here is the code if interested:</p>
<p><div id="wpshdo_12" class="wp-synhighlighter-outer"><div id="wpshdt_12" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_12"></a><a id="wpshat_12" class="wp-synhighlighter-title" href="#codesyntax_12"  onClick="javascript:wpsh_toggleBlock(12)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_12" onClick="javascript:wpsh_code(12)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_12" onClick="javascript:wpsh_print(12)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_12" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;">$j=jQuery<span class="sy0">.</span>noConflict<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
checkTime<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
ct = <span class="kw7">setInterval</span><span class="br0">&#40;</span>checkTime<span class="sy0">,</span> 1000<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw3">function</span> checkTime<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
	<span class="co1">//var t = new Date();</span>
	<span class="kw2">var</span> <span class="kw7">d</span>=<span class="kw1">new</span> <a href="http://www.google.com/search?q=date%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:date.html"><span class="kw5">Date</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="kw2">var</span> h=<span class="kw7">d</span><span class="sy0">.</span><span class="kw7">getHours</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="kw2">var</span> m=<span class="kw7">d</span><span class="sy0">.</span><span class="kw7">getMinutes</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="kw2">var</span> s=<span class="kw7">d</span><span class="sy0">.</span><span class="kw7">getSeconds</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
	$j<span class="br0">&#40;</span><span class="st0">'#hour'</span><span class="br0">&#41;</span><span class="sy0">.</span>css<span class="br0">&#40;</span><span class="st0">'rotate'</span><span class="sy0">,</span> 360<span class="sy0">/</span>60<span class="sy0">*</span>h<span class="sy0">*</span>5<span class="br0">&#41;</span><span class="sy0">;</span>
	$j<span class="br0">&#40;</span><span class="st0">'#minute'</span><span class="br0">&#41;</span><span class="sy0">.</span>css<span class="br0">&#40;</span><span class="st0">'rotate'</span><span class="sy0">,</span> 360<span class="sy0">/</span>60<span class="sy0">*</span>m<span class="br0">&#41;</span><span class="sy0">;</span>
	$j<span class="br0">&#40;</span><span class="st0">'#second'</span><span class="br0">&#41;</span><span class="sy0">.</span>css<span class="br0">&#40;</span><span class="st0">'rotate'</span><span class="sy0">,</span> 360<span class="sy0">/</span>60<span class="sy0">*</span>s<span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="kw1">if</span> <span class="br0">&#40;</span>h<span class="sy0">&lt;</span><span class="nu0">10</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
		h=<span class="st0">&quot;0&quot;</span><span class="sy0">+</span>h
	<span class="br0">&#125;</span><span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>h<span class="sy0">&gt;</span>12<span class="br0">&#41;</span><span class="br0">&#123;</span>
		h<span class="sy0">-</span>=<span class="nu0">12</span><span class="sy0">;</span>
		<span class="kw1">if</span> <span class="br0">&#40;</span>h<span class="sy0">&lt;</span><span class="nu0">10</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
			h=<span class="st0">&quot;0&quot;</span><span class="sy0">+</span>h
		<span class="br0">&#125;</span>
	<span class="br0">&#125;</span>
	<span class="kw1">if</span><span class="br0">&#40;</span>m<span class="sy0">&lt;</span><span class="nu0">10</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
		m=<span class="st0">&quot;0&quot;</span><span class="sy0">+</span>m
	<span class="br0">&#125;</span>
	<span class="kw1">if</span><span class="br0">&#40;</span>s<span class="sy0">&lt;</span><span class="nu0">10</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
		s=<span class="st0">&quot;0&quot;</span><span class="sy0">+</span> s
	<span class="br0">&#125;</span>
	$j<span class="br0">&#40;</span><span class="st0">'#curTime'</span><span class="br0">&#41;</span><span class="sy0">.</span>html<span class="br0">&#40;</span><span class="st0">&quot;The time is &quot;</span> <span class="sy0">+</span> h <span class="sy0">+</span><span class="st0">&quot;:&quot;</span> <span class="sy0">+</span>m<span class="sy0">+</span><span class="st0">&quot;:&quot;</span> <span class="sy0">+</span>s<span class="br0">&#41;</span>
<span class="br0">&#125;</span></pre></div></div><br />
<script src="http://code.jquery.com/jquery-latest.js"></script><br />
<script src="http://graphnickdesign.com/extras/js/jquery-rotate.js"></script><br />
<script>$j=jQuery;
			checkTime();
			ct = setInterval(checkTime, 1000);
			function checkTime(){
				//var t = new Date();
				var d=new Date();
				var h=d.getHours();
				var m=d.getMinutes();
				var s = d.getSeconds();
				$j('#hour').css('rotate', 360/60*h*5);
				$j('#minute').css('rotate', 360/60*m);
				$j('#second').css('rotate', 360/60*s);	
				if (h<10){
					h="0"+h
				}else if (h>12){
					h-=12;
					if (h<10){
						h="0"+h
					}
				}
				if(m<10){
					m="0"+m
				}
				if(s<10){
					s="0"+ s
				}
				$j('#curTime').html("<strong>The time is</strong> " + h +":" +m+":" +s)
			}</script><br />
<style>
		#clock{
			background:white url('http://graphnickdesign.com/demo/images/clock.gif') top left no-repeat;
			width:300px;
			height:300px;
			margin-left:30px;
			margin-bottom:30px
		}
		 #minute{
			position:relative;
			top:-300px
		}
		#second{
			position:relative;
			top:-600px
		}
		#curTime{
			text-align:center;
			margin-bottom:20px
		}
		#clockHolder{
			width:350px;
			float:right
}
	</style>
]]></content:encoded>
			<wfw:commentRss>http://graphnickdesign.com/blog/experiment-jquery-clock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three-Peat Win For Web Design of the Year 2010</title>
		<link>http://graphnickdesign.com/blog/2010-web-design-of-year/</link>
		<comments>http://graphnickdesign.com/blog/2010-web-design-of-year/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 17:37:04 +0000</pubDate>
		<dc:creator>graphnick</dc:creator>
				<category><![CDATA[Awards]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Inspiration]]></category>
		<category><![CDATA[awards]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://graphnickdesign.com/?p=500</guid>
		<description><![CDATA[O.C. Tanner has awarded the Design of the Year Award to me for the third straight year. Our designs have been getting better as our O.C. Tanner designers have stepped up to the competition. For the 2010 year, there has been more collaboration and synergy as we have been able to bounce ideas off each [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_501" class="wp-caption alignright" style="width: 136px"><a href="http://graphnickdesign.com/wp-content/uploads/2011/03/schofield_haroldsen_2010_design_of_year.jpg"><img class="size-full wp-image-501  " title="schofield_haroldsen_2010_design_of_year" src="http://graphnickdesign.com/wp-content/uploads/2011/03/schofield_haroldsen_2010_design_of_year.jpg" alt="Schofield and Haroldsen 2010 Web Design of Year Winners " width="126" height="140" /></a><p class="wp-caption-text">Todd Schofield and Nick Haroldsen--2010 Web Design of Year</p></div>
<p>O.C. Tanner has awarded the Design of the Year Award to me for the third straight year. Our designs have been getting better as our O.C. Tanner designers have stepped up to the competition. For the 2010 year, there has been more collaboration and synergy as we have been able to bounce ideas off each other and work closer together. <span id="more-500"></span></p>
<p>Todd Schofield was the <span class="emphasis2">key designer</span> on the project who I owe a great deal of gratitude toward for coming up with such a stellar award-winning design. It was his design I used to develop an engaging Flash page. The client was for the resort agency, <a href="http://graphnickdesign.com/go/interval/">Interval International</a> who loved the design.</p>
<div id="attachment_502" class="wp-caption aligncenter" style="width: 530px"><a href="http://graphnickdesign.com/go/interval/"><img class="size-full wp-image-502" title="interval_international" src="http://graphnickdesign.com/wp-content/uploads/2011/03/interval_lg.jpg" alt="Interval International 2010 Web Design of Year" width="520" height="289" /></a><p class="wp-caption-text">Web Portal for Interval International</p></div>
<p>The added animation with user interaction helps to <span class="emphasis3">engage the user</span> to seek different portions of the site. All animation was done dynamically using a combination of XML and Actionscript utilizing TweenMax for the transitions. It was a good collaborative effort between Todd and myself that earned this great award recognition. The award came with a Â cool Â crystal trophy as well as a certificate to choose from an assortment of cool things such as an iPod Touch and a Dyson vacuum (the two items I chose the previous two years). Check out <a href="http://graphnickdesign.com/blog/web-design-of-the-year-2009/">last year&#8217;s</a> winning and the <a href="http://graphnickdesign.com/blog/2008-designs-of-the-year/">one prior</a>Â to see what I have done previously.</p>
<p><span class="emphasis1">Thank you</span> to all the other designers at Tanner that have kept us all moving forward, pushing our creativity to higher levels.</p>
]]></content:encoded>
			<wfw:commentRss>http://graphnickdesign.com/blog/2010-web-design-of-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Five Ways to Stimulate a Developer&#8217;s Mind</title>
		<link>http://graphnickdesign.com/blog/stimulate-your-mind/</link>
		<comments>http://graphnickdesign.com/blog/stimulate-your-mind/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 16:59:17 +0000</pubDate>
		<dc:creator>graphnick</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Inspiration]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[inspiration]]></category>

		<guid isPermaLink="false">http://graphnickdesign.com/?p=449</guid>
		<description><![CDATA[We are all in constant need of self improvement. We search for ways to better our mind, body, and spirit. There are many ways to stimulate our minds. We all are familiar with GIGO (Garbage In Garbage Out). Like our programs, what we choose to put into our minds and body will affect our outcome. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://graphnickdesign.com/wp-content/uploads/2011/03/graphnick_brain.gif"><img src="http://graphnickdesign.com/wp-content/uploads/2011/03/graphnick_brain.gif" alt="" title="Stimulate Your Brain" width="350" height="360" class="alignright size-full wp-image-473" /></a>We are all in constant need of self improvement. We search for ways to better our mind, body, and spirit. There are many ways to stimulate our minds. We all are familiar with GIGO (Garbage In Garbage Out). Like our programs, what we choose to put into our minds and body will affect our outcome. Here are five things that I have found helpful in improving mind stimulation: <span id="more-449"></span></p>
<ol>
<li><a href="#hd1">Frequent Exercise</a></li>
<li><a href="#hd2">Find an Outlet</a></li>
<li><a href="#hd3">Share Ideas with Others</a></li>
<li><a href="#hd4">Experimentation</a></li>
<li><a href="#hd5">Continually Learn Something New</a></li>
</ol>
<h3><a name="hd1"></a>Frequent Exercise</h3>
<p>It is stereotyped that the typical developer does little exercise besides the finger exercises that coding brings. The image of a scrawny pale-skinned coder who spends the majority of his life in the basement comes to mind. It is essential to break through that stereotype to engage other parts of the brain and get out and exercise on regular basis. The goal isn&#8217;t to become Mr. Universe with the perfect body, but to engage the mind. Studies have proven that there is a substantial increase in brain activity with frequent exercise. </p>
<p>I have found that frequent exercise has helped not me feeling better about myself physical, but mentally and emotionally. Lately, I have been doing the P90X routine three days a week and running two to three of the other days of the week. When I first started doing this regimen, it was difficult and I wasn&#8217;t seeing immediate results. It sometimes feels counter intuitive for my logical mind to think that pushing myself to the point of exhaustion can increase brain function, especially when I feel like it is doing just the opposite. For me, the results have been coming little by little where I have seen my physique change as well my thinking has become a bit clearer.</p>
<h3><a name="hd2"></a>Find an Outlet</h3>
<p>Do you ever get stuck on a project where you keep banging your head against the wall? Over and over you go, trying to figure out why something is not working the way it seem it should. The best way to overcome such problems is to take a step back&mdash;pause, and reflect. Get away from the problem and focus on other things for a while. I love going running for this reason. I also love to go hiking and skiing. Others have their own outlets that allow their mind to reboot. What is your outlet?</p>
<h3><a name="hd3"></a>Share Ideas with Others</h3>
<p>The beautiful thing about technology today is that it brings easy ways to share your ideas with others. It is true that developers are not typically social creatures and would rather stay secluded in their own world. Living in a box will hinder the minds ability to expand to its potential. I in no way consider myself a social expert. In fact, like most programmer types, I am a bit introverted. It takes come conscious effort to step out of my shell and share my ideas with others. Social media provides easy ways for us to share ideas with others without having to leave our comfortable space. Blogging is one way to get my ideas out there. However, blogging isn&#8217;t for everyone; there are forums and other places to share your input with colleagues that share the same interests. Getting a dialogue going is a great way to synergize the ideas. As you become an active part of your niche community, everyone benefits.</p>
<h3><a name="hd4"></a>Experimentation</h3>
<p>Some of my greatest ideas come from a bit of trial and error. Experimenting with tidbits here and there is essential to my growth. We all tend to do things the same way over and over. We know it works, so why change it? There is no way to be innovative with that way of thinking. Technology is driven upon experimentation. Try out other people&#8217;s experiments, expanding on their efforts. It can start from the simplest of experiments that leads to the coolest of creations. Publish or share those experiments with others around you for the potential that others may also expound on your experiment.</p>
<h3><a name="hd5"></a>Continually Learn Something New</h3>
<p>We are always needing to improve our skills. Technology will not slow down, neither should we. There is no time to play catch-up. I know some designers that feel they don&#8217;t need to keep up with the latest trends and technology. Frankly, I don&#8217;t know how they survive. Sure, they may not be developers and they do have a stable job that keeps them employed. But their limit of knowledge on the newer capabilities technology has to offer limits their creative potential. Oh how much greater can we all benefit if we but allow ourselves a portion of the vast knowledge that is out there. I know I have indeed a great deal to learn. Don&#8217;t limit your knowledge.</p>
]]></content:encoded>
			<wfw:commentRss>http://graphnickdesign.com/blog/stimulate-your-mind/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Clone Objects in AS3</title>
		<link>http://graphnickdesign.com/blog/clone-objects-as3/</link>
		<comments>http://graphnickdesign.com/blog/clone-objects-as3/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 00:33:21 +0000</pubDate>
		<dc:creator>graphnick</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[textfield]]></category>
		<category><![CDATA[textformat]]></category>

		<guid isPermaLink="false">http://graphnickdesign.com/?p=430</guid>
		<description><![CDATA[Cloning simple objects in AS3 can have great advantages when creating an application. It creates shortcuts for recreating an object. I have put together a simple example of my exploration with cloning TextFormat and TextField objects. These methods can be applied to cloning other objects as well. Cloning a TextFormat Have you had projects where [...]]]></description>
			<content:encoded><![CDATA[<p>Cloning simple objects in AS3 can have great advantages when creating an application. It creates shortcuts for recreating an object. I have put together a simple example of my exploration with cloning TextFormat and TextField objects. These methods can be applied to cloning other objects as well.<span id="more-430"></span></p>
<h3>Cloning a TextFormat</h3>
<p>Have you had projects where you were using the same basic TextFormat for your textfields and wanted to base sub-textformats on a base format and change a few properties? This is something I found I was needing all the time where I had one instance of <code>baseTextFormat</code> with the basic attributes and wanted to say <code>myOtherFormat:TextFormat=baseTextFormat</code>. The problem with this is when you change formatting for myOtherFormat without it being a clone of the first, it will change the formatting on the baseTextFormat, which is obviously not what is wanted.</p>
<p>So, the solution here is to create a clone of the first by utilizing the ByteArray class:</p>
<div id="wpshdo_13" class="wp-synhighlighter-outer"><div id="wpshdt_13" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_13"></a><a id="wpshat_13" class="wp-synhighlighter-title" href="#codesyntax_13"  onClick="javascript:wpsh_toggleBlock(13)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_13" onClick="javascript:wpsh_code(13)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_13" onClick="javascript:wpsh_print(13)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_13" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw3">function</span> cloneFormat<span class="br0">&#40;</span>o<span class="sy0">:*</span><span class="br0">&#41;</span><span class="sy0">:*</span> <span class="br0">&#123;</span>
	<span class="kw2">var</span> obj<span class="sy0">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span class="kw5">Object</span></a> = getByteArray<span class="br0">&#40;</span>o<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// this returns null on MovieClips</span>
	<span class="kw1">return</span> obj<span class="sy0">;</span>
<span class="br0">&#125;</span>
<span class="kw3">function</span> getByteArray<span class="br0">&#40;</span>obj<span class="sy0">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span class="kw5">Object</span></a><span class="br0">&#41;</span><span class="br0">&#123;</span>
	<span class="kw2">var</span> byteArray<span class="sy0">:</span><a href="http://www.google.com/search?q=bytearray%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bytearray.html"><span class="kw5">ByteArray</span></a>=<span class="kw1">new</span> <a href="http://www.google.com/search?q=bytearray%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bytearray.html"><span class="kw5">ByteArray</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
	byteArray<span class="sy0">.</span><span class="kw7">writeObject</span><span class="br0">&#40;</span>obj<span class="br0">&#41;</span><span class="sy0">;</span>
	byteArray<span class="sy0">.</span><span class="kw7">position</span> = <span class="nu0">0</span><span class="sy0">;</span>
	<span class="kw1">return</span> byteArray<span class="sy0">.</span><span class="kw7">readObject</span><span class="br0">&#40;</span><span class="br0">&#41;</span>
<span class="br0">&#125;</span></pre></div></div>
<p>The above method returns a basic object, so in order to parse it to a TextFormat object you will need add a parsing method that will loop through each object of the byteArray and put it in a new TextFormat:</p>
<div id="wpshdo_14" class="wp-synhighlighter-outer"><div id="wpshdt_14" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_14"></a><a id="wpshat_14" class="wp-synhighlighter-title" href="#codesyntax_14"  onClick="javascript:wpsh_toggleBlock(14)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_14" onClick="javascript:wpsh_code(14)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_14" onClick="javascript:wpsh_print(14)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_14" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw3">function</span> cloneFormat<span class="br0">&#40;</span>o<span class="sy0">:*</span><span class="br0">&#41;</span><span class="sy0">:*</span> <span class="br0">&#123;</span>
	<span class="kw2">var</span> obj<span class="sy0">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span class="kw5">Object</span></a> = getByteArray<span class="br0">&#40;</span>o<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// this returns null on MovieClips</span>
	obj = parseFormat<span class="br0">&#40;</span>obj<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// parse the object to a TextFormat</span>
	<span class="kw1">return</span> obj<span class="sy0">;</span>
<span class="br0">&#125;</span>
<span class="kw3">function</span> parseFormat<span class="br0">&#40;</span>obj<span class="br0">&#41;</span><span class="sy0">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span class="kw5">TextFormat</span></a><span class="br0">&#123;</span>
	<span class="kw2">var</span> _tf<span class="sy0">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span class="kw5">TextFormat</span></a>=<span class="kw1">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span class="kw5">TextFormat</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> prop<span class="sy0">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span class="kw5">String</span></a> <span class="kw1">in</span> obj<span class="br0">&#41;</span><span class="br0">&#123;</span>
		<span class="co1">//trace(prop)</span>
		_tf<span class="br0">&#91;</span>prop<span class="br0">&#93;</span>=obj<span class="br0">&#91;</span>prop<span class="br0">&#93;</span>
	<span class="br0">&#125;</span>
	<span class="kw1">return</span> _tf
<span class="br0">&#125;</span></pre></div></div>
<p>Here is some basic code example to clone the baseFormat:
<div id="wpshdo_15" class="wp-synhighlighter-outer"><div id="wpshdt_15" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_15"></a><a id="wpshat_15" class="wp-synhighlighter-title" href="#codesyntax_15"  onClick="javascript:wpsh_toggleBlock(15)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_15" onClick="javascript:wpsh_code(15)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_15" onClick="javascript:wpsh_print(15)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_15" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><span class="co1">// setup your baseFormat</span>
<span class="kw2">var</span> baseFormat<span class="sy0">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span class="kw5">TextFormat</span></a> = <span class="kw1">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span class="kw5">TextFormat</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
baseFormat<span class="sy0">.</span><span class="kw7">size</span>=<span class="nu0">20</span><span class="sy0">;</span>
baseFormat<span class="sy0">.</span><span class="kw7">font</span>=<span class="st0">&quot;_sans&quot;</span><span class="sy0">;</span>
baseFormat<span class="sy0">.</span><span class="kw7">color</span>=0xff0000<span class="sy0">;</span>
<span class="kw2">var</span> my_txt<span class="sy0">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a> = <span class="kw1">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
my_txt<span class="sy0">.</span><span class="kw7">defaultTextFormat</span> = baseFormat<span class="sy0">;</span> <span class="co1">// apply the format</span>
my_txt<span class="sy0">.</span><span class="kw7">text</span>=<span class="st0">&quot;Hello World&quot;</span><span class="sy0">;</span>
<span class="kw7">addChild</span><span class="br0">&#40;</span>my_txt<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw2">var</span> my_txt2<span class="sy0">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a> = <span class="kw1">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
my_txt2<span class="sy0">.</span><span class="kw7">width</span>=<span class="nu0">300</span><span class="sy0">;</span>
my_txt2<span class="sy0">.</span><span class="kw7">wordWrap</span>=<span class="kw1">true</span><span class="sy0">;</span>
my_txt2<span class="sy0">.</span><span class="kw7">multiline</span>=<span class="kw1">true</span><span class="sy0">;</span>
my_txt2<span class="sy0">.</span><span class="kw7">autoSize</span>=<a href="http://www.google.com/search?q=textfieldautosize%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfieldautosize.html"><span class="kw5">TextFieldAutoSize</span></a><span class="sy0">.</span><span class="kw8">LEFT</span><span class="sy0">;</span>
<span class="co1">// clone the baseFormat</span>
<span class="kw2">var</span> myFormat2 = cloneFormat<span class="br0">&#40;</span>baseFormat<span class="br0">&#41;</span>
<span class="co1">// change format slightly to see difference</span>
myFormat2<span class="sy0">.</span><span class="kw7">color</span>=0x005599<span class="sy0">;</span>
<span class="co1">// apply the format</span>
my_txt2<span class="sy0">.</span><span class="kw7">defaultTextFormat</span>=myFormat2
my_txt2<span class="sy0">.</span><span class="kw7">text</span>=<span class="st0">&quot;Here the text uses format from the first was cloned with a color variation&quot;</span>
<span class="kw7">addChild</span><span class="br0">&#40;</span>my_txt2<span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>
<h3>Cloning a TextField</h3>
<p>Cloning a TextField is almost as easy as cloning the TextFormat. It requires a couple minor adjustments where the defaultTextFormat and transform properties need additional parsing:</p>
<div id="wpshdo_16" class="wp-synhighlighter-outer"><div id="wpshdt_16" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_16"></a><a id="wpshat_16" class="wp-synhighlighter-title" href="#codesyntax_16"  onClick="javascript:wpsh_toggleBlock(16)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_16" onClick="javascript:wpsh_code(16)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_16" onClick="javascript:wpsh_print(16)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_16" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw3">function</span> parseTextField<span class="br0">&#40;</span>_obj<span class="sy0">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span class="kw5">Object</span></a><span class="sy0">,</span> _tf<span class="sy0">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a><span class="br0">&#41;</span><span class="sy0">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a><span class="br0">&#123;</span>
	<span class="kw2">var</span> _textField<span class="sy0">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a> =<span class="kw1">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> prop<span class="sy0">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span class="kw5">String</span></a> <span class="kw1">in</span> _obj<span class="br0">&#41;</span><span class="br0">&#123;</span>
		<span class="kw1">if</span> <span class="br0">&#40;</span>prop==<span class="st0">&quot;transform&quot;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
			_textField<span class="br0">&#91;</span>prop<span class="br0">&#93;</span> =<span class="kw1">new</span> <a href="http://www.google.com/search?q=transform%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:transform.html"><span class="kw5">Transform</span></a><span class="br0">&#40;</span>_tf<span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="br0">&#125;</span><span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>prop==<span class="st0">&quot;defaultTextFormat&quot;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
			_textField<span class="br0">&#91;</span>prop<span class="br0">&#93;</span> = parseFormat<span class="br0">&#40;</span>_obj<span class="br0">&#91;</span>prop<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="br0">&#125;</span><span class="kw1">else</span><span class="br0">&#123;</span>
			<span class="kw1">try</span><span class="br0">&#123;</span>
				_textField<span class="br0">&#91;</span>prop<span class="br0">&#93;</span>=_obj<span class="br0">&#91;</span>prop<span class="br0">&#93;</span>
			<span class="br0">&#125;</span><span class="kw1">catch</span><span class="br0">&#40;</span>err<span class="sy0">:</span><a href="http://www.google.com/search?q=error%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:error.html"><span class="kw5">Error</span></a><span class="br0">&#41;</span><span class="br0">&#123;</span>
				<span class="kw7">trace</span><span class="br0">&#40;</span><span class="st0">&quot;Error Hit: &quot;</span><span class="sy0">+</span>err<span class="br0">&#41;</span>
			<span class="br0">&#125;</span>
		<span class="br0">&#125;</span>
	<span class="br0">&#125;</span>
	<span class="kw1">return</span> _textField
<span class="br0">&#125;</span></pre></div></div>
<h3>Setting Up a Clone Class</h3>
<p>To create this as a class to handle the passed parameters isn&#8217;t too difficult. I have added a couple checks to see what type of object gets passed so that it parses the objects according to their needed requirements. Here is my class code, use at your own discretion and know that it is not fully tested or supported:</p>
<div id="wpshdo_17" class="wp-synhighlighter-outer"><div id="wpshdt_17" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_17"></a><a id="wpshat_17" class="wp-synhighlighter-title" href="#codesyntax_17"  onClick="javascript:wpsh_toggleBlock(17)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_17" onClick="javascript:wpsh_code(17)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_17" onClick="javascript:wpsh_print(17)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_17" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw4">package</span> <span class="br0">&#123;</span>
	<span class="kw1">import</span> <span class="kw6">flash.utils</span><span class="sy0">.</span><a href="http://www.google.com/search?q=bytearray%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bytearray.html"><span class="kw5">ByteArray</span></a><span class="sy0">;</span>
	<span class="kw1">import</span> <span class="kw6">flash.text</span><span class="sy0">.</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span class="kw5">TextFormat</span></a><span class="sy0">;</span>
	<span class="kw1">import</span> <span class="kw6">flash.text</span><span class="sy0">.</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a><span class="sy0">;</span>
	<span class="kw1">import</span> <span class="kw6">flash.utils</span><span class="sy0">.</span><a href="http://www.google.com/search?q=bytearray%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bytearray.html"><span class="kw5">ByteArray</span></a><span class="sy0">;</span>
	<span class="kw1">import</span> <span class="kw6">flash.utils</span><span class="sy0">.</span><span class="kw7">getQualifiedClassName</span><span class="sy0">;</span>
	<span class="kw1">import</span> <span class="kw6">flash.geom</span><span class="sy0">.</span><a href="http://www.google.com/search?q=transform%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:transform.html"><span class="kw5">Transform</span></a><span class="sy0">;</span>
	<span class="kw1">import</span> <span class="kw6">flash.display</span><span class="sy0">.</span><a href="http://www.google.com/search?q=displayobject%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:displayobject.html"><span class="kw5">DisplayObject</span></a><span class="sy0">;</span>
	<span class="kw1">public</span> <span class="kw4">class</span> Clone <span class="br0">&#123;</span>
		<span class="kw1">public</span> <span class="kw3">function</span> Clone<span class="br0">&#40;</span>o<span class="sy0">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span class="kw5">Object</span></a><span class="br0">&#41;</span> <span class="br0">&#123;</span>
			<span class="co1">// constructor code	</span>
		<span class="br0">&#125;</span>
		<span class="kw1">public</span> static <span class="kw3">function</span> <span class="kw7">clone</span><span class="br0">&#40;</span>o<span class="sy0">:*</span><span class="br0">&#41;</span><span class="sy0">:*</span> <span class="br0">&#123;</span>
			<span class="kw2">var</span> <span class="kw7">type</span> = getClassName<span class="br0">&#40;</span>o<span class="br0">&#41;</span><span class="sy0">;</span>
			<span class="kw2">var</span> obj<span class="sy0">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span class="kw5">Object</span></a> = getByteArray<span class="br0">&#40;</span>o<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// this returns null on MovieClips</span>
			<span class="kw1">switch</span><span class="br0">&#40;</span><span class="kw7">type</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
				<span class="kw1">case</span> <span class="st0">&quot;TextFormat&quot;</span><span class="sy0">:</span>
				<span class="kw1">default</span><span class="sy0">:</span>
					obj = parseFormat<span class="br0">&#40;</span>obj<span class="br0">&#41;</span><span class="sy0">;</span>
					<span class="kw1">break</span><span class="sy0">;</span>
				<span class="kw1">case</span> <span class="st0">&quot;TextField&quot;</span><span class="sy0">:</span>
					obj = parseTextField<span class="br0">&#40;</span>obj<span class="sy0">,</span>o<span class="br0">&#41;</span><span class="sy0">;</span>
					<span class="kw1">break</span><span class="sy0">;</span>
			<span class="br0">&#125;</span>
			<span class="kw1">return</span> obj<span class="sy0">;</span>
		<span class="br0">&#125;</span>
		<span class="kw1">private</span> static <span class="kw3">function</span> getByteArray<span class="br0">&#40;</span>obj<span class="sy0">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span class="kw5">Object</span></a><span class="br0">&#41;</span><span class="br0">&#123;</span>
			<span class="kw2">var</span> byteArray<span class="sy0">:</span><a href="http://www.google.com/search?q=bytearray%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bytearray.html"><span class="kw5">ByteArray</span></a>=<span class="kw1">new</span> <a href="http://www.google.com/search?q=bytearray%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bytearray.html"><span class="kw5">ByteArray</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
			byteArray<span class="sy0">.</span><span class="kw7">writeObject</span><span class="br0">&#40;</span>obj<span class="br0">&#41;</span><span class="sy0">;</span>
			byteArray<span class="sy0">.</span><span class="kw7">position</span> = <span class="nu0">0</span><span class="sy0">;</span>
			<span class="kw1">return</span> byteArray<span class="sy0">.</span><span class="kw7">readObject</span><span class="br0">&#40;</span><span class="br0">&#41;</span>
		<span class="br0">&#125;</span>
		<span class="kw1">private</span> static <span class="kw3">function</span> getClassName<span class="br0">&#40;</span>o<span class="sy0">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span class="kw5">Object</span></a><span class="br0">&#41;</span><span class="sy0">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span class="kw5">String</span></a><span class="br0">&#123;</span>
       		<span class="kw2">var</span> fullClassName<span class="sy0">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span class="kw5">String</span></a> = <span class="kw7">getQualifiedClassName</span><span class="br0">&#40;</span>o<span class="br0">&#41;</span><span class="sy0">;</span>
			<span class="kw1">return</span> fullClassName<span class="sy0">.</span><span class="kw7">slice</span><span class="br0">&#40;</span>fullClassName<span class="sy0">.</span><span class="kw7">lastIndexOf</span><span class="br0">&#40;</span><span class="st0">&quot;::&quot;</span><span class="br0">&#41;</span> <span class="sy0">+</span> 2<span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="br0">&#125;</span>
		<span class="kw1">private</span> static <span class="kw3">function</span> parseFormat<span class="br0">&#40;</span>_obj<span class="br0">&#41;</span><span class="sy0">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span class="kw5">TextFormat</span></a><span class="br0">&#123;</span>
			<span class="kw2">var</span> _tf<span class="sy0">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span class="kw5">TextFormat</span></a>=<span class="kw1">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html"><span class="kw5">TextFormat</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
			<span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> prop<span class="sy0">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span class="kw5">String</span></a> <span class="kw1">in</span> _obj<span class="br0">&#41;</span><span class="br0">&#123;</span>
				<span class="co1">//trace(prop)</span>
				_tf<span class="br0">&#91;</span>prop<span class="br0">&#93;</span>=_obj<span class="br0">&#91;</span>prop<span class="br0">&#93;</span>
			<span class="br0">&#125;</span>
			<span class="kw1">return</span> _tf
		<span class="br0">&#125;</span>
		<span class="kw1">private</span> static <span class="kw3">function</span> parseTextField<span class="br0">&#40;</span>_obj<span class="sy0">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span class="kw5">Object</span></a><span class="sy0">,</span>o<span class="sy0">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a><span class="br0">&#41;</span><span class="sy0">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a><span class="br0">&#123;</span>
			<span class="kw2">var</span> _textField<span class="sy0">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a> =<span class="kw1">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
			<span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> prop<span class="sy0">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span class="kw5">String</span></a> <span class="kw1">in</span> _obj<span class="br0">&#41;</span><span class="br0">&#123;</span>
				<span class="kw1">if</span> <span class="br0">&#40;</span>prop==<span class="st0">&quot;transform&quot;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
					<span class="co1">// actually setting transform properties becomes complex</span>
					_textField<span class="br0">&#91;</span>prop<span class="br0">&#93;</span> =<span class="kw1">new</span> <a href="http://www.google.com/search?q=transform%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:transform.html"><span class="kw5">Transform</span></a><span class="br0">&#40;</span>o<span class="br0">&#41;</span><span class="sy0">;</span>
				<span class="br0">&#125;</span><span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>prop==<span class="st0">&quot;defaultTextFormat&quot;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
					_textField<span class="br0">&#91;</span>prop<span class="br0">&#93;</span> = parseFormat<span class="br0">&#40;</span>_obj<span class="br0">&#91;</span>prop<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
				<span class="br0">&#125;</span><span class="kw1">else</span><span class="br0">&#123;</span>
					<span class="kw1">try</span><span class="br0">&#123;</span>
						_textField<span class="br0">&#91;</span>prop<span class="br0">&#93;</span>=_obj<span class="br0">&#91;</span>prop<span class="br0">&#93;</span>
					<span class="br0">&#125;</span><span class="kw1">catch</span><span class="br0">&#40;</span>err<span class="sy0">:</span><a href="http://www.google.com/search?q=error%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:error.html"><span class="kw5">Error</span></a><span class="br0">&#41;</span><span class="br0">&#123;</span>
						<span class="kw7">trace</span><span class="br0">&#40;</span><span class="st0">&quot;Error Hit: &quot;</span><span class="sy0">+</span>err<span class="br0">&#41;</span>
					<span class="br0">&#125;</span>
				<span class="br0">&#125;</span>
			<span class="br0">&#125;</span>
			<span class="kw1">return</span> _textField
		<span class="br0">&#125;</span>
	<span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div>
<h3>Cloning Other Objects</h3>
<p>With my Clone class there are additional possibilities besides the cloning of the described objects. It becomes more difficult when attempting to clone more complex display objects such as MovieClips. If the content within the MovieClip or Sprite is more dynamic and created at runtime, it may not simply be re-instantiated from the library as a new instance. Therefore, a different approach is needed to duplicating your MovieClip. You could use the BitmapData class instead if it is only necessary to duplicate the pixels. However, this is not always what is wanted, especially if the MovieClip has animation. If you attempt using the ByteArray method for returning the more complex Matrix of values a MovieClip contains, you end up with null. I will not get into the complexities of it here but a good example was given within the <a href="http://www.kirupa.com/forum/showthread.php?p=1939827">Kirupa forums by Senocular</a>. His method works, but he does explain some of the limitations of his method.</p>
<p>Try it out for yourself. You will find some great use out of my Clone Class and perhaps you may find great ways to extend it. If you have any brilliant other uses of cloning objects using my Class or other approaches, please don&#8217;t forget to leave a comment. Thank you for your feedback.<br />
]]></content:encoded>
			<wfw:commentRss>http://graphnickdesign.com/blog/clone-objects-as3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Order Matters When Creating a TextField</title>
		<link>http://graphnickdesign.com/blog/order-matters-creating-textfield/</link>
		<comments>http://graphnickdesign.com/blog/order-matters-creating-textfield/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 17:23:50 +0000</pubDate>
		<dc:creator>graphnick</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[textfield]]></category>

		<guid isPermaLink="false">http://graphnickdesign.com/?p=422</guid>
		<description><![CDATA[It may be obvious to most Flash programmers that order of operation is key to running a program. What may not be so apparent is to what order to apply properties to a TextField class so that it gets rendered properly at runtime. Issues With TextField in Some Browsers Recently I was pulling out my [...]]]></description>
			<content:encoded><![CDATA[<p>It may be obvious to most Flash programmers that order of operation is key to running a program. What may not be so apparent is to what order to apply properties to a TextField class so that it gets rendered properly at runtime. <span id="more-422"></span></p>
<h3>Issues With TextField in Some Browsers</h3>
<p>Recently I was pulling out my hair wondering why my TextField looked one way in one browser, but a bit differently in another. I had always been under the impression that the Flash Player always worked the same regardless of the browser. Apparently, this isn&#8217;t always the case. As seen with the TextField, if some properties were not applied in the correct order, not only can the visual output be different, but some properties will not be available at runtime.</p>
<p>Below is an example of how I was creating my TextField which proved to cause issues when view in (could you believe) IE. The example illustrates that when the width is set after a string has been put into the TextField, the calculation of certain properties of the TextField can be off. Anything relating to the numLines can also be miscalculated (such as getLineOffset(), etc.). </p>
<div id="wpshdo_18" class="wp-synhighlighter-outer"><div id="wpshdt_18" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_18"></a><a id="wpshat_18" class="wp-synhighlighter-title" href="#codesyntax_18"  onClick="javascript:wpsh_toggleBlock(18)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_18" onClick="javascript:wpsh_code(18)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_18" onClick="javascript:wpsh_print(18)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_18" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw2">var</span> myText_txt<span class="sy0">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a>= <span class="kw1">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
myText_txt<span class="sy0">.</span><span class="kw7">text</span> = myString<span class="sy0">;</span> <span class="co1">// string with enough characters to cause multiple lines</span>
myText_txt<span class="sy0">.</span><span class="kw7">setTextFormat</span><span class="br0">&#40;</span>_txtFormat<span class="br0">&#41;</span><span class="sy0">;</span>
myText_txt<span class="sy0">.</span><span class="kw7">width</span> = <span class="nu0">100</span><span class="sy0">;</span>
myText_txt<span class="sy0">.</span><span class="kw7">wordWrap</span> = <span class="kw1">true</span><span class="sy0">;</span>
myText_txt<span class="sy0">.</span><span class="kw7">multiline</span> = <span class="kw1">true</span><span class="sy0">;</span>
myText_txt<span class="sy0">.</span><span class="kw7">autoSize</span> = <a href="http://www.google.com/search?q=textfieldautosize%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfieldautosize.html"><span class="kw5">TextFieldAutoSize</span></a><span class="sy0">.</span><span class="kw8">LEFT</span><span class="sy0">;</span>
<span class="kw7">addChild</span><span class="br0">&#40;</span>myText_txt<span class="br0">&#41;</span>
<span class="kw7">trace</span><span class="br0">&#40;</span>myText_txt<span class="sy0">.</span><span class="kw7">numLines</span><span class="br0">&#41;</span> <span class="co1">// output in IE is 1 --output in other browsers gives the correct numLines</span></pre></div></div>
<h3>Finding the Solution</h3>
<p>I went through much painstaking trial and error to pinpoint where the problem was. At first, I thought it came because the browser in question could not render all the properties of the TextField until it was added to the stage (so I applied a listener  to be added to the stage. This is true for the most part, but it was not where the root of the issue was coming from. Finally, I discovered the issue wasn&#8217;t complex at all. I found that the width <strong>MUST</strong> be set <strong>BEFORE</strong> text is applied to the TextField. Wordwrap and multiline should also be set before text is applied. </p>
<p>Some things that require being called <strong>AFTER</strong> the text is applied is setTextFormat() and autoSize. You cannot apply format to a TextField if there is no text in it because setTextFormat actually sets the format of the text and not the TextField. The same goes for autoSize: there is nothing to autosize to if there is no text in it to begin with. Also, if the TextField is not applied to the stage, some of the properties will not be available (or at least rendered) either.</p>
<p>Here is the fixed code with the everything in the correct order:</p>
<div id="wpshdo_19" class="wp-synhighlighter-outer"><div id="wpshdt_19" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_19"></a><a id="wpshat_19" class="wp-synhighlighter-title" href="#codesyntax_19"  onClick="javascript:wpsh_toggleBlock(19)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_19" onClick="javascript:wpsh_code(19)" title="Show code only"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_19" onClick="javascript:wpsh_print(19)" title="Print code"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://graphnickdesign.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_19" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw2">var</span> myText_txt<span class="sy0">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a>= <span class="kw1">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html"><span class="kw5">TextField</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
myText_txt<span class="sy0">.</span><span class="kw7">width</span> = <span class="nu0">100</span><span class="sy0">;</span>  <span class="co1">// set the width before adding text</span>
myText_txt<span class="sy0">.</span><span class="kw7">text</span> = myString<span class="sy0">;</span> <span class="co1">// string with enough characters to cause multiple lines</span>
myText_txt<span class="sy0">.</span><span class="kw7">wordWrap</span> = <span class="kw1">true</span><span class="sy0">;</span>
myText_txt<span class="sy0">.</span><span class="kw7">multiline</span> = <span class="kw1">true</span><span class="sy0">;</span>
myText_txt<span class="sy0">.</span><span class="kw7">setTextFormat</span><span class="br0">&#40;</span>_txtFormat<span class="br0">&#41;</span><span class="sy0">;</span>
myText_txt<span class="sy0">.</span><span class="kw7">autoSize</span> = <a href="http://www.google.com/search?q=textfieldautosize%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfieldautosize.html"><span class="kw5">TextFieldAutoSize</span></a><span class="sy0">.</span><span class="kw8">LEFT</span><span class="sy0">;</span>
<span class="kw7">addChild</span><span class="br0">&#40;</span>myText_txt<span class="br0">&#41;</span>
<span class="kw7">trace</span><span class="br0">&#40;</span>myText_txt<span class="sy0">.</span><span class="kw7">numLines</span><span class="br0">&#41;</span> <span class="co1">// output in all browsers gives the correct numLines</span></pre></div></div>
<h3>Conclusion</h3>
<p>Order of operation really does make a big difference when dealing with a dynamic TextField. If you are ever unsure the optimal order of operation, just remember, the solution may be easier than you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://graphnickdesign.com/blog/order-matters-creating-textfield/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

