                 <?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>Substance Labs &#187; Research</title>
	<atom:link href="http://labs.findsubstance.com/category/research/feed/" rel="self" type="application/rss+xml" />
	<link>http://labs.findsubstance.com</link>
	<description>Create. Constantly.</description>
	<lastBuildDate>Wed, 27 Jul 2011 18:18:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Fixing the IE8 Form Button with Background Image On Click CSS Bug</title>
		<link>http://labs.findsubstance.com/2009/05/21/ie8-form-button-with-background-image-on-click-css-bug/</link>
		<comments>http://labs.findsubstance.com/2009/05/21/ie8-form-button-with-background-image-on-click-css-bug/#comments</comments>
		<pubDate>Thu, 21 May 2009 20:36:06 +0000</pubDate>
		<dc:creator>Cory Duncan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[ie8]]></category>

		<guid isPermaLink="false">http://labs.findsubstance.com/?p=107</guid>
		<description><![CDATA[That&#8217;s really the best title I could come up with to describe this head-banger of a bug I&#8217;ve encountered. I searched and scoured the tubes of the Internet, but couldn&#8217;t find anyone talking about it, so I thought I&#8217;d share my experience so far. From my testing, I&#8217;ve found this is only an issue in [...]]]></description>
				<content:encoded><![CDATA[<p>That&#8217;s really the best title I could come up with to describe this head-banger of a bug I&#8217;ve encountered. I searched and scoured the tubes of the Internet, but couldn&#8217;t find anyone talking about it, so I thought I&#8217;d share my experience so far.</p>
<p>From my testing, I&#8217;ve found this is only an issue in Internet Explorer 8 (hats off to Microsoft for a brand new <abbr title="Cascading Style Sheets">CSS</abbr> bug).</p>
<h2 id="thesetup">The Setup</h2>
<p>The setup for this bug is fairly straightforward. It requires a <code>&lt;button&gt;</code> or submit <code>&lt;input&gt;</code> that has a background image. For this example, I&#8217;ll use the <code>&lt;button&gt;</code> element. I&#8217;ll also be using image replacement to hide the button&#8217;s <abbr title="HyperText Markup Language">HTML</abbr> text. I believe this makes the bug more apparent, though it has nothing to do with the actual bug.</p>
<p>The markup:</p>
<pre><code>&lt;button type="submit"&gt;Submit&lt;/button&gt;</code></pre>
<p>The CSS:</p>
<pre><code>button {
	background: url(button.png) no-repeat 0 0;
	border: 0;
	display: block;
	height: 30px;
	margin: 0;
	padding: 0;
	text-indent: -9999px;
	width: 81px;
	}
button:hover {
	background-position: 0 -30px;
	}</code></pre>
<h2>Experiencing the Bug</h2>
<p>On first glance, it appears that everything is fine in <abbr title="Internet Explorer">IE</abbr>8. The problem occurs when the button is in its active state. Upon clicking the button, the background image shifts -1px to the top and left, though the container of the button stays in the same position. Here&#8217;s a <a href="/d/ie8-form-button-with-background-image-on-click-css-bug/bug.html">demo</a> (view this in IE8) of the bug in action, and here&#8217;s a screenshot (I&#8217;ve added a red outline to help illustrate the background shift):</p>
<p><img src="/d/ie8-form-button-with-background-image-on-click-css-bug/bug.png" alt="" /></p>
<h2>So how do you fix this?</h2>
<p>I was able to find some workarounds for this bug, and though none are completely bulletproof, all are better than the alternative (doing nothing).</p>
<h3>Solution 1: Mo&#8217; Markup + Mo&#8217; CSS (<a href="/d/ie8-form-button-with-background-image-on-click-css-bug/solution1.html">demo</a>)</h3>
<p>One option is to add an extra element within the <code>&lt;button&gt;</code> and target that element for the background-image. We can use the same base CSS from <a href="#thesetup">The Setup</a> with some additional IE-specific CSS.</p>
<p>The markup:</p>
<pre><code>&lt;button type="submit"&gt;&lt;span&gt;Submit&lt;/span&gt;&lt;/button&gt;</code></pre>
<p>The IE-specific (version 8 and below) CSS:</p>
<pre><code>button {
	position: relative;
	}
button span {
	background: url(button.png) no-repeat 0 0;
	height: 30px;
	left: 0;
	position: absolute;
	top: 0;
	width: 100%;
	}
button:hover span {
	background-position: 0 -30px;
	}</code></pre>
<p>There are a number of problems with this solution.</p>
<ol>
<li>Requires extraneous markup.</li>
<li>Will not work for a submit <code>&lt;input&gt;</code> element, as it does not allow for any child elements.</li>
<li>Requires IE specific CSS to absolutely position the extra element &#8211; neglecting to do so will result in an opposite 1px shift to the right and bottom in IE (version 8 and below). If this CSS is not targeted for IE, Mozilla browsers (at least Firefox 2 and 3) exhibit a different bug altogether (a topic for a future post).</li>
</ol>
<p>Because of the problems associated with this solution, I don&#8217;t recommend this approach.</p>
<h3>Solution 2: JavaScript-only</h3>
<p>I&#8217;m sure this could be fixed using IE8-targeted JavaScript, but I&#8217;d rather not rely on it, as it would break down if the browsing device has JavaScript disabled or lacks JavaScript support. Let&#8217;s try a CSS-only method (my preference)&#8230;</p>
<h3>Solution 3: CSS-only (<a href="/d/ie8-form-button-with-background-image-on-click-css-bug/solution3.html">demo</a>)</h3>
<p>With the release of IE8, Microsoft has added several <a href="http://blogs.msdn.com/ie/archive/2008/09/08/microsoft-css-vendor-extensions.aspx" target="_blank">proprietary CSS extensions</a>. Each of these extensions work in IE8, but not in previous IE versions, or any non-IE browsers. Because this bug is isolated to IE8, we can take advantage of these extensions.</p>
<p>The CSS:</p>
<pre><code>button:active {
	-ms-background-position-x: 1px;
	-ms-background-position-y: -29px;
	}</code></pre>
<p>This CSS counters the bug, by positioning the background top and left 1px. This offset is relative to the button’s hover state, using the height dimension to offset the y-axis (in this case 30px height -1px offset results in -29px for the y-axis offset). If your button has no hover state, the offset would be relative to the button&#8217;s default background position. This can be safely included in your main stylesheet without affecting other modern browsers, but as a best practice I&#8217;d recommend including this in a separate IE stylesheet along with any other IE-specific CSS (using <a href="http://quirksmode.org/css/condcom.html" target="_blank">CSS conditional comments</a> to target IE).</p>
<p>As I mentioned, none of the solutions are bulletproof and that includes this one. If you click the button and drag your cursor off the button&#8217;s boundaries, the background shift is visible. I feel that this type of interaction is atypical and most users will click the button without much movement, so this is my recommended approach for the time being.</p>
<h2>In Conclusion</h2>
<p>I&#8217;d love to hear any alternative solutions for this issue. Track and vote for this bug on <a href="https://connect.microsoft.com/onecare/feedback/ViewFeedback.aspx?FeedbackID=455723" target="_blank">Microsoft Connect</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://labs.findsubstance.com/2009/05/21/ie8-form-button-with-background-image-on-click-css-bug/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>UPDATED: Using AS3 to Upload and Encode Images</title>
		<link>http://labs.findsubstance.com/2008/10/24/updated-using-as3-to-upload-and-encode-images/</link>
		<comments>http://labs.findsubstance.com/2008/10/24/updated-using-as3-to-upload-and-encode-images/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 18:43:43 +0000</pubDate>
		<dc:creator>Shaun Tinney</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://labs.findsubstance.com/?p=99</guid>
		<description><![CDATA[After many requests, I&#8217;ve updated the demo and source files for the wildly popular labs post Using AS3 to Upload and Encode Images. Hope everyone finds it helpful.]]></description>
				<content:encoded><![CDATA[<p>After many requests, I&#8217;ve updated the <a href="/d/as3-upload-encode-images/">demo</a> and <a href="/d/as3-upload-encode-images/as3-upload-encode-images.zip">source</a> files for the wildly popular labs post <a href="/2008/04/03/as3-upload-encode-images/">Using AS3 to Upload and Encode Images</a>. Hope everyone finds it helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://labs.findsubstance.com/2008/10/24/updated-using-as3-to-upload-and-encode-images/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Dynamic Image Creation with Adobe AIR</title>
		<link>http://labs.findsubstance.com/2008/10/16/dynamic-image-creation-with-adobe-air/</link>
		<comments>http://labs.findsubstance.com/2008/10/16/dynamic-image-creation-with-adobe-air/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 22:15:00 +0000</pubDate>
		<dc:creator>Shaun Tinney</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[image encoding]]></category>

		<guid isPermaLink="false">http://labs.findsubstance.com/?p=45</guid>
		<description><![CDATA[We&#8217;ve put together a simple AIR application that allows you to load a SWF, select any class, and export a series of PNG or JPEG images. Potential uses for this tool range from photoshop-style batch image creation to randomized image painting ala Erik Natzke. There&#8217;s a built in help section, but here&#8217;s a short video [...]]]></description>
				<content:encoded><![CDATA[<p>We&#8217;ve put together a simple <a href="http://get.adobe.com/air/">AIR</a> application that allows you to load a SWF, select any class, and export a series of PNG or JPEG images. Potential uses for this tool range from photoshop-style batch image creation to <a href="http://www.flickr.com/photos/natzke/2924200721/">randomized image painting</a> ala <a href="http://jot.eriknatzke.com/">Erik Natzke</a>.</p>
<p>There&#8217;s a built in help section, but here&#8217;s a short video that outlines the basic idea:</p>
<p><object width="500" height="377"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=1986693&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=990000&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=1986693&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=990000&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="377"></embed></object></p>
<p>Since I didn&#8217;t include a voiceover for this example, the basic steps involved are:</p>
<ol>
<li>Export a custom class on an empty symbol.</li>
<li>Write logic to add a text field and draw a circle.</li>
<li>Publish SWF and load into the image encoder.</li>
<li>Create 20 PNG images in the &#8220;output&#8221; folder on the Desktop.</li>
</ol>
<p>Extra notes on functionality:</p>
<ol>
<li>The application attempts to pass in the current serial index to the constructor of the class you&#8217;ve chosen. This has a variety of uses, but is especially good for looking up array data, or directly populating a text field (as in the example above).</li>
<li>Even if you don&#8217;t declare a constructor parameter, the export will still run just fine. This makes it easy to see what any class will look like as an image, or to export a series of images from a <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Math.html#random()">Math.random</a>-based visualization class.</li>
</ol>
<p>The application is available for download <a href="/d/dynamic-image-creation-with-adobe-air/ImageEncoder.air">here</a>. If you have any questions or requests, post a comment and I&#8217;ll do my best to help out.</p>
]]></content:encoded>
			<wfw:commentRss>http://labs.findsubstance.com/2008/10/16/dynamic-image-creation-with-adobe-air/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Layering Transparent Flash Content over HTML with Scripted Masking</title>
		<link>http://labs.findsubstance.com/2008/06/30/transparent-flash-over-html/</link>
		<comments>http://labs.findsubstance.com/2008/06/30/transparent-flash-over-html/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 14:59:15 +0000</pubDate>
		<dc:creator>Shaun Tinney</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://labs.findsubstance.com/2008/06/30/transparent-flash-over-html/</guid>
		<description><![CDATA[Anyone who has ever tried to display transparent Flash content over HTML knows that getting things to sort properly on the z-index can be frustrating. Flash has an annoying tendency to force itself to render above of all other content Some browsers have trouble rendering plugin content consistently, which can make HTML stacked below Flash [...]]]></description>
				<content:encoded><![CDATA[<p>Anyone who has ever tried to display <a href="/d/transparent-flash-over-html/">transparent Flash content over <abbr title="Hypertext Markup Language">HTML</abbr></a> knows that getting things to sort properly on the z-index can be frustrating. <del>Flash has an annoying tendency to force itself to render above of all other content</del>  Some browsers have trouble rendering plugin content consistently, which can make HTML stacked below Flash content inaccessible to the user. The technique described below is meant to ensure a consistent cross-browser user experience when it comes to issues with flickering or unwanted re-sorting of transparent Flash content. </p>
<p>We at <a href="http://findsubstance.com">Substance</a> have come across this a number of times, and <a href="/d/transparent-flash-over-html/transparent-flash-over-html.zip">the best solution</a> we have found is to knock out the areas of the Flash movie that require accessible content displayed below. This can be accomplished rather easily with the use of <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/BlendMode.html">layer blend modes</a>. </p>
<p>The first step to making this work is to set <strong>wmode</strong> in your HTML <a href="http://code.google.com/p/swfobject/wiki/SWFObject_2_0_documentation">Flash embed code</a> to <strong>transparent</strong>. After that is done, you can immediately take advantage of this trick:</p>
<ol>
<li>Set the blendMode property in your Document Class to BlendMode.LAYER</li>
<li>Set the blendMode property of your knockout area to BlendMode.ERASE</li>
</ol>
<p>This approach differs from creating a true mask, which acts as a window to the clip being masked, by doing the reverse &ndash; creating a window <em>through</em> the clip being masked, which in this case is the entire SWF.</p>
<p>Here is a quick example ( assuming &#8220;this&#8221; is your document class ):</p>
<pre><code>// set blendMode for Document Class;
this.blendMode = BlendMode.LAYER;

// create knockout area;
var knockout : Sprite = new Sprite();
			
// draw 50 x 100 px box;
with ( knockout.graphics )
{
	beginFill( 0x000000 );
	drawRect( 0, 0, 50, 100 );
}

// give mask knockout powers;
knockout.blendMode = BlendMode.ERASE;

// add knockout mask to stage;
this.addChild( knockout );</code></pre>
<p>On the <a href="http://arakawagrip.com">Arakawa home page</a>, the Flash area is set to fill the browser window completely. The logo, navigation, and footer are all knocked out, with a listener attached to the stage for Event.RESIZE so that the footer window always remains at the bottom of the file. This is pretty simple, but here&#8217;s a snippet of to show how to keep an item positioned at the bottom of the stage:</p>
<pre><code>// add listener to stage in constructor;
stage.addEventListener( Event.RESIZE, onResize );

// resize listener in class body;
private function onResize () : void
{
	knockout.y = stage.stageHeight - knockout.height;
}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://labs.findsubstance.com/2008/06/30/transparent-flash-over-html/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
