<?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>eingko weblog &#187; Javascript</title>
	<atom:link href="http://www.eingko.net/blog/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.eingko.net/blog</link>
	<description>a web developer's thoughts and musings</description>
	<lastBuildDate>Wed, 09 Dec 2009 23:42:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Internet Explorer, Flash, Alignment Gotcha</title>
		<link>http://www.eingko.net/blog/2008/11/19/internet-explorer-flash-alignment-gotcha/</link>
		<comments>http://www.eingko.net/blog/2008/11/19/internet-explorer-flash-alignment-gotcha/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 21:16:15 +0000</pubDate>
		<dc:creator>eingko</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[XHTML/CSS]]></category>

		<guid isPermaLink="false">http://www.eingko.net/blog/?p=33</guid>
		<description><![CDATA[I ran into a rather annoying issue the other day related to content alignment in Flash; as usual, this problem exists exclusively in Internet Explorer. To be more specific, it is an issue with how the Flash Player ActiveX control is written.
If you are aligning content in Flash that uses the Stage width or height [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into a rather annoying issue the other day related to content alignment in Flash; as usual, this problem exists exclusively in Internet Explorer. To be more specific, it is an issue with how the Flash Player ActiveX control is written.</p>
<p>If you are aligning content in Flash that uses the Stage width or height as a variable (e.g., you want to center a MovieClip) and you do it on initialization (i.e., in code and on the first frame), you may run in to this issue.  Here is an image demonstrating what you might see:</p>
<p><img src="http://www.eingko.net/blog/wp-content/uploads/2008/11/ie_flash_bug.gif" alt="" title="Internet Explorer, Flash, Alignment Gotcha" width="400" height="440" class="alignleft size-full wp-image-34" style="border: none;" /></p>
<p>Note that in the &#8220;before&#8221; screen, the content is centered horizontally, while in the &#8220;after&#8221; screen, the content is only half-visible and appears to be &#8220;centered&#8221; on the left margin.</p>
<p>If you run a test &#8211; output the Stage width to a text field, you&#8217;ll see that the width will be returned as 0.</p>
<p>As far as I know, there are two solutions to this problem.  If you&#8217;re embedding your Flash using swfObject, then make sure that you omit the &#8220;scale&#8221; attribute. For example, modify the following:</p>
<pre class="code">
var params = {
    bgcolor: "#000000",
    menu: "false",
    scale: "noScale",
    allowFullScreen: true
};
</pre>
<p>To something that looks like this:</p>
<pre class="code">
var params = {
    bgcolor: "#000000",
    menu: "false",
    allowFullScreen: true
};
</pre>
<p>Alternatively, if you absolutely need that attribute.  You can create an &#8220;EnterFrame&#8221; event listener that detects when the Stage width is greater than 0 and then remove the listener.  Here&#8217;s an example in ActionScript 2:</p>
<pre class="code">
this.onEnterFrame = function() {
    if (Stage.width > 0) {
        init(); // Pass to initialization function
        this.onEnterFrame = null; // Clear enterFrame listener
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.eingko.net/blog/2008/11/19/internet-explorer-flash-alignment-gotcha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Press SPACEBAR or ENTER to activate and use this control&#8221;</title>
		<link>http://www.eingko.net/blog/2006/04/14/press-spacebar-or-enter-to-activate-and-use-this-control/</link>
		<comments>http://www.eingko.net/blog/2006/04/14/press-spacebar-or-enter-to-activate-and-use-this-control/#comments</comments>
		<pubDate>Fri, 14 Apr 2006 22:34:57 +0000</pubDate>
		<dc:creator>eingko</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.eingko.net/blog/?p=14</guid>
		<description><![CDATA[Three days ago (April 11) Microsoft released an Internet Explorer update in response to the patent battle between Microsoft and Eolas. After installing the update, Internet Explorer (not other browsers, fortunately) users will be required to &#8220;activate&#8221; embedded objects and plug-ins before they can interact with them. Here&#8217;s what sucks, most users will receive this [...]]]></description>
			<content:encoded><![CDATA[<p>Three days ago (April 11) Microsoft released an <a title="Internet Explorer Update" href="http://support.microsoft.com/?kbid=912945">Internet Explorer update</a> in response to the patent battle between Microsoft and Eolas. After installing the update, Internet Explorer (not other browsers, fortunately) users will be required to &#8220;activate&#8221; embedded objects and plug-ins before they can interact with them. Here&#8217;s what sucks, most users will receive this update <strong>automatically</strong> via Windows Update. Embedded objects and controls affected are:</p>
<ul>
<li>Adobe  Reader</li>
<li>Apple QuickTime Player</li>
<li>Macromedia Flash</li>
<li>Microsoft Windows Media Player</li>
<li>Real Networks RealPlayer</li>
<li>Sun Java Virtual Machine</li>
</ul>
<p>In order to activate these objects, users are required to press the space bar, enter key, or use the mouse to click on the item. Anyone that&#8217;s tested the <a title="Internet Explorer 7 beta" href="http://www.microsoft.com/windows/IE/ie7/ie7betaredirect.mspx">Internet Explorer 7 beta</a> will have noticed similar behavior within that browser.  According to <a target="_blank" title="w3schools browser statistics" href="http://www.w3schools.com/browsers/browsers_stats.asp">w3schools browser statistics</a>, over 60% of web users browse using Internet Explorer, meaning within the next few days approximately 60% of visitors to Flash websites, or sites using embedded media will be required to activate the media before being able to use it; because of this, some users may assume that the website is broken.</p>
<p>Here&#8217;s the good news:  <a title="Microsoft has posted a solution" href="http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/activating_activex.asp">Microsoft has posted a solution</a> for web developers that would like to avoid their content being blocked.  Essentially, in order to avoid this problem all that a web developer needs to do is embed the object via external script files.  Those who have opted for <a title="Unobtrusive Flash Object" href="http://www.bobbyvandersluis.com/ufo/">Unobtrusive Flash Object</a> placement within their websites will not be affected, because their content is already embedded in this manner.</p>
<p>What&#8217;s ironic about this entire situation is that it actually forces developers to use a more standards compliant approach, go figure.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eingko.net/blog/2006/04/14/press-spacebar-or-enter-to-activate-and-use-this-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript Favelet: Outline</title>
		<link>http://www.eingko.net/blog/2006/03/09/javascript-favelet-outline/</link>
		<comments>http://www.eingko.net/blog/2006/03/09/javascript-favelet-outline/#comments</comments>
		<pubDate>Fri, 10 Mar 2006 00:12:37 +0000</pubDate>
		<dc:creator>eingko</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.eingko.net/blog/?p=12</guid>
		<description><![CDATA[Whenever I produce I website I am always thankful for the Firefox Web Developer Toolbar extension; it&#8217;s an incredible convenience.  One particular feature that I use constantly is &#8220;Outline&#8221;. This feature is great for seeing the locations of various elements on any page. But I&#8217;ve always wished that there was an equivalent feature/extension for [...]]]></description>
			<content:encoded><![CDATA[<p>Whenever I produce I website I am always thankful for the <a title="Web Developer Extension" href="https://addons.mozilla.org/extensions/moreinfo.php?id=60&#038;application=firefox">Firefox Web Developer Toolbar extension</a>; it&#8217;s an incredible convenience.  One particular feature that I use constantly is &#8220;Outline&#8221;. This feature is great for seeing the locations of various elements on any page. But I&#8217;ve always wished that there was an equivalent feature/extension for Internet Explorer.  Well, to my knowledge, there isn&#8217;t, but I&#8217;ve thrown together a little script (Javascript, to be exact) that outlines (virtually) any given element in colors of my choice.  Here&#8217;s the script:</p>
<pre class="javascript">function outline(){
var tagArray=['p','a','div'];
var colors=['red','green','blue'];
for (var i=0; i&lt;tagArray.length; i++){
var tags = document.getElementsByTagName(tagArray[i]);
for (var j=0; j&lt;tags.length; j++){
var tag = tags[j];
tag.style.border = ['1px solid '+colors[i]];
}
}
}</pre>
<p>Obviously the code is not that complex, but it can be incredibly useful.  One particularly nice thing about it is that one could place a fairly large amount of elements into the arrays.</p>
<p>Here&#8217;s a bookmark that I use anytime I want to call this script into action: <a title="Bookmark me" href="javascript:(function(){var tagArray=['div','span','p','a','ul','li','h2','form']; var colors=['#f00','#0f0','#0ff','#00f','#de8d59','#72b872','#6ba0a0','#9f9fe4']; for (var i=0; i<tagArray.length; i++){ var tags = document.getElementsByTagName(tagArray[i]); for (var j=0; j<tags.length; j++){ var tag = tags[j]; tag.style.border = ['1px solid '+colors[i]]; } }})();">Bookmark me</a>. Using it this way is far more convenient, in my opinion.  Well, I hope someone finds this useful; enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eingko.net/blog/2006/03/09/javascript-favelet-outline/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
