<?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>Interactive IQ : The Hessler Design Blog &#187; classes</title>
	<atom:link href="http://www.hesslerdesign.com/blog/tag/classes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hesslerdesign.com/blog</link>
	<description>Smart Developers = Smart Websites</description>
	<lastBuildDate>Thu, 26 Jan 2012 23:00:19 +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>Correcting the Flash Builder 4.5 Mobile TextInputSkin Component</title>
		<link>http://www.hesslerdesign.com/blog/flash/correcting-the-flash-builder-4-5-mobile-textinputskin-component/</link>
		<comments>http://www.hesslerdesign.com/blog/flash/correcting-the-flash-builder-4-5-mobile-textinputskin-component/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 05:36:23 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[flash builder]]></category>

		<guid isPermaLink="false">http://www.hesslerdesign.com/blog/?p=749</guid>
		<description><![CDATA[I&#8217;ve been working on a mobile application in the recently released Flash Builder 4.5, which has support for exporting native apps for iOS and Android. While the engineering is largely sound and well done (with the exception of some big-name missing components from the &#8220;mobile-optimized&#8221; list, such as ComboBox), there are definitely a few glitches [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a mobile application in the recently released Flash Builder 4.5, which has support for exporting native apps for iOS and Android. While the engineering is largely sound and well done (with the exception of some big-name missing components from the &#8220;mobile-optimized&#8221; list, such as ComboBox), there are definitely a few glitches that I&#8217;ve encountered thus far in my experience with it. One such glitch is in the TextInput component.</p>
<p><span id="more-749"></span></p>
<h4>The Glitch</h4>
<p>In the mobile app that I&#8217;ve been working on, the design calls for the text input label to be placed &#8220;inside&#8221; of the text input field, on the left side. As such, I needed to add left padding to the TextInput component, so the text field wouldn&#8217;t overlap the label, which was sitting behind the TextInput control. So I set up my code to include the appropriate padding, and tested the result. When viewing the application, it looked just like it should, with the label positioned &#8220;inside&#8221; the TextInput component.</p>
<p><img src="http://www.hesslerdesign.com/blog/wp-content/uploads/2011/11/flash_builder_mobile_app_input_fields_blank.gif" alt="" title="flash_builder_mobile_app_input_fields_blank" width="480" height="191" class="aligncenter size-full wp-image-768" style="border:1px solid #dadada;" /></p>
<p>&nbsp;</p>
<p>However, when I started typing a value into the fields, that&#8217;s when I saw the glitch:</p>
<p><img src="http://www.hesslerdesign.com/blog/wp-content/uploads/2011/11/flash_builder_mobile_app_input_fields_glitch.gif" alt="" title="flash_builder_mobile_app_input_fields_glitch" width="480" height="191" class="aligncenter size-full wp-image-766" style="border:1px solid #dadada;" /></p>
<p>The problem was this: When typing in your text into the field, and the text goes longer than the width of the visible width of the text field inside of the component, you completely lose the cursor and can&#8217;t see the text you&#8217;re entering. That is, until your text width is as long as or greater than the width of the TextInput component. Then, your text suddenly shifts, with the text field taking up 100% of the width of the TextInput component. So naturally, I let out a huge sigh and asked, &#8220;What happened to my left padding? Did I do something wrong?&#8221;</p>
<p>The answer to my question is this: The padding never got incorporated into the component correctly. And no, I didn&#8217;t do anything wrong. Adobe did.</p>
<h4>The Solution</h4>
<p>In my wrestling with how to fix this issue, I copied over the default TextInputSkin file (spark.skins.mobile.TextInputSkin) and put it into my project files. Then I opened it up and started investigating. Here&#8217;s what I found:</p>
<p>In the &#8220;layoutContents&#8221; method, I found a very big issue with the logic. And while it may seem like a small, innocent issue, it looms large when trying to add padding of any sort to the component. The issue is caused by 3 errors in the code of this function.</p>
<p><strong>Error #1</strong></p>
<div style="padding:12px; background:#fff; border:1px solid #dadada;">
<code style="margin-left: 20px;">textDisplay.leftMargin = paddingLeft;</code><br />
<code style="margin-left: 20px;">textDisplay.rightMargin = paddingRight;</code>
</div>
<p>These two lines are worthless. Why? It doesn&#8217;t solve any problems. It creates the skip in the text inputting described above, specifically when paired with the other two errors below. So, I commented these two lines out.</p>
<p>&nbsp;</p>
<p><strong>Error #2</strong></p>
<div style="padding:12px; background:#fff; border:1px solid #dadada;">
<code style="margin-left: 20px;">setElementSize(textDisplay, unscaledWidth, adjustedTextHeight);</code>
</div>
<p>This error is just plain and simple wrong. There&#8217;s a variable for &#8220;unscaledWidth&#8221;, which is the width of the ENTIRE component, NOT the width of the textDisplay (i.e. text field) after having padding taken into consideration. There&#8217;s actually a variable called &#8220;unscaledTextWidth&#8221; in the code, which is the value that SHOULD be used in this instance of &#8220;setElementSize&#8221;, because the textDisplay should have a width that has the left and right padding taken into consideration.  So, I changed this line to be:</p>
<div style="padding:12px; background:#fff; border:1px solid #dadada;">
<code style="margin-left: 20px;">setElementSize(textDisplay, unscaledTextWidth, adjustedTextHeight);</code>
</div>
<p>&nbsp;</p>
<p><strong>Error #3</strong></p>
<div style="padding:12px; background:#fff; border:1px solid #dadada;">
<code style="margin-left: 20px;">setElementPosition(textDisplay, 0, textY);</code>
</div>
<p>This error, like the last, is also just plain wrong. The 2nd argument for the &#8220;setElementPosition&#8221; method is the X value, which you&#8217;ll notice is HARD-CODED to &#8220;0&#8243;. This means that no matter what your left padding value is, the textDisplay will ALWAYS be set to the left side of the component. The x value should be based on the value of the left padding. So, I changed this line to be:</p>
<div style="padding:12px; background:#fff; border:1px solid #dadada;">
<code style="margin-left: 20px;">setElementPosition(textDisplay, paddingLeft, textY);</code>
</div>
<h4>Conclusion</h4>
<p>With the 3 errors above fixed, my TextInput component was finally working as intended, with the correct padding values, no intermittent skipping, and no random resizing of the text field inside of the component. Rather, like any other good text input field out there, it only displays the text width it should, while hiding the rest.</p>
<p><img src="http://www.hesslerdesign.com/blog/wp-content/uploads/2011/11/flash_builder_mobile_app_input_fields_fixed.gif" alt="" title="flash_builder_mobile_app_input_fields_fixed" width="480" height="191" class="aligncenter size-full wp-image-773" style="border:1px solid #dadada;" /></p>
<p>&nbsp;</p>
<p>So if you find yourself questioning why something isn&#8217;t working as intended, take a few minutes (or hours, in some unfortunate instances) and look into the class/component/code you&#8217;re working with. Not only will you get a better understanding of how everything is set up, but you might just find another spot where the software engineers overlooked something and made an error.</p>
<p>Until next time, happy coding!</p>
<h4>Postscript</h4>
<p>Even though I am not a fan of how Adobe laid out this TextInputSkin, I must admit that I can see how/why it was done the way it was. There aren&#8217;t many times where a mobile application would call for a situation like the one I had. Chances are, Adobe&#8217;s quality assurance and testing didn&#8217;t think to include such a circumstance. After all, most mobile application components like text input boxes are set up to take up 100% of the screen (or close to it) to optimize hit area and visual space. So, giving them the benefit of the doubt, I can&#8217;t say I&#8217;m mad at Adobe for how they put things together. But I stick to my statement that if something isn&#8217;t working as intended, take some time to look into the code behind the scenes. You just might find something in need of fixing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hesslerdesign.com/blog/flash/correcting-the-flash-builder-4-5-mobile-textinputskin-component/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Confetti Class for ActionScript 3.0</title>
		<link>http://www.hesslerdesign.com/blog/flash/confetti-class-for-actionscript-3-0/</link>
		<comments>http://www.hesslerdesign.com/blog/flash/confetti-class-for-actionscript-3-0/#comments</comments>
		<pubDate>Mon, 27 Sep 2010 18:30:37 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[classes]]></category>

		<guid isPermaLink="false">http://www.hesslerdesign.com/blog/?p=622</guid>
		<description><![CDATA[On a recent project I was working on, I had to create animated snowfall, to give the effect of a winter wonderland. Rather than doing timeline animation (WAY too much detail to do with individual snowflakes by hand), I made a class that displays/generates the effect of random snowfall. And rather than just making the [...]]]></description>
			<content:encoded><![CDATA[<p>On a recent project I was working on, I had to create animated snowfall, to give the effect of a winter wonderland.  Rather than doing timeline animation (WAY too much detail to do with individual snowflakes by hand), I made a class that displays/generates the effect of random snowfall.  And rather than just making the class specific to snowflakes, I made it a generic and flexible Confetti class to be used in multiple ways.</p>
<p>A few notes about the class, its flexibility, and it’s use:</p>
<ul>
<li>Overall, the class automatically assigns random X coordinates, fall times, delays, scale, alpha, rotation, and tint (if colors are specified) for the effect of true randomness and depth of field.</li>
<li>To import, instantiate, and start a batch of confetti in the file, only 4 lines of code are needed.</li>
<li>There is a public “start()” method for the class, rather than having the class auto-start (though the demo below does auto-start, but that is through the parent file, not the class).  This is done in an effort to save in performance.  There are also public methods for “stop()”, “clear()”, and “remove()”, done in an effort to to be able to phase out the confetti (stop), clear all current instances of individual confetti pieces (clear), or stop and clear out all confetti pieces (remove).</li>
<li>The class is set up to pass in an Object as the parameter when creating your Confetti object, which takes up to 6 optional attributes: width, height, colors, maxPieces, symbol, and speed.  If any or all of these are not defined, default values will be used.  Through much time and testing, calculations were solidified to make for realistic default settings.</li>
<li>The class allows for passing in a custom symbol to use, rather than using the auto-generated one. In the demo below, all &#8220;shape modes&#8221; other than &#8220;Auto&#8221; are instances of MovieClips from the Library, set to export to ActionScript. These custom MovieClip symbols can have multiple frames, too.  If a MovieClip symbol has multiple frames, the class will randomly assign a frame to show for each individual piece.</li>
</ul>
<p>With that all said, here&#8217;s a demo of the Confetti class.  And in response to the request, the class and a sample FLA file are available for download (see link below the demo).  Feel free to toy around with it, change the settings, and have fun with it.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="548" height="444" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0"><param name="src" value="http://www.hesslerdesign.com/blog/wp-content/uploads/2010/09/confettiDemo_blog.swf" /><embed type="application/x-shockwave-flash" width="548" height="444" src="http://www.hesslerdesign.com/blog/wp-content/uploads/2010/09/confettiDemo_blog.swf"></embed></object></p>
<div style="margin-top:24px;"><a href="http://www.hesslerdesign.com/downloads/confetti/Confetti_Sample.zip"><img class="aligncenter size-full wp-image-426" title="Download Confetti Sample" src="http://www.hesslerdesign.com/blog/wp-content/uploads/2011/01/btn_downloadSample.png" alt="Download Confetti Sample" width="150" height="29" /></a></div>
<p>Until next time, happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hesslerdesign.com/blog/flash/confetti-class-for-actionscript-3-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>VideoMax Custom Flash Video Player Class Now Available!</title>
		<link>http://www.hesslerdesign.com/blog/flash/mediaplayer-custom-flash-video-player-class-now-available/</link>
		<comments>http://www.hesslerdesign.com/blog/flash/mediaplayer-custom-flash-video-player-class-now-available/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 01:00:27 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://www.hesslerdesign.com/blog/?p=336</guid>
		<description><![CDATA[What is VideoMax? VideoMax is a very lightweight, fast, flexible, and easy-to-implement custom Flash video player class that can be used in any ActionScript 3.0 file. Some of the key highlights of the VideoMax class are: Lightweight: Importing the VideoMax class and creating an instance adds only 12kb to overall file weight. Compare that to [...]]]></description>
			<content:encoded><![CDATA[<h4>What is VideoMax?</h4>
<p>VideoMax is a very lightweight, fast, flexible, and easy-to-implement custom Flash video player class that can be used in any ActionScript 3.0 file. Some of the key highlights of the VideoMax class are:</p>
<ul>
<li><strong>Lightweight:</strong> Importing the VideoMax class and creating an instance adds only 12kb to overall file weight. Compare that to the built-in Adobe &#8216;flvPlayback&#8217; component, which adds 58kb to the overall file weight. Do the math. That&#8217;s nearly 500% heavier than this VideoMax class.</li>
<li><strong>Easy to Use:</strong> With just 3 lines of code, you can import the VideoMax class, create an instance of the player, and add it to your Flash file. And because of its dynamically-built nature, there are NO Library components needed. That&#8217;s right, NONE. All of the assets included in the VideoMax class are 100% built from scratch with nothing but ActionScript 3.0 code.</li>
<li><strong>Customizable:</strong> You can change a number of attributes to your VideoMax instances, so you can have a video player that is as unique as the video it plays. The customizable attributes include Width, Height, Auto Play, Auto Rewind, Auto Size, Buffer, Looping, Control Bar visibility, Tint, Play Button overlay, End Frame visibility, and onStart/onComplete listeners.</li>
<li><strong>Communicative:</strong> By using the onStart and onComplete listener attributes (and accompanying parameter attributes), you can have VideoMax dispatch events that call functions back in the parent file when the video starts and/or ends.</li>
<li><strong>Self-Sufficient:</strong> With its robust set of default attributes, VideoMax takes care of wrapping up all of the loose ends. Once you create your VideoMax instance, you can sit back and relax, knowing that everything is taken care of, including control bar resizing and positioning, buffering, automatic video resizing within the player, and more. Just import the class, create the instance, assign it attributes, and add it to your file. VideoMax will take care of the rest for you.</li>
</ul>
<h4>Where Can I Get VideoMax?</h4>
<p>VideoMax is available for download at the <a href="http://www.hesslerdesign.com/videomax">Official VideoMax Page</a> on HesslerDesign.com. There, you will find a free download of VideoMax, as well as examples and documentation on implementing VideoMax in your own Flash projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hesslerdesign.com/blog/flash/mediaplayer-custom-flash-video-player-class-now-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

