<?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>CLOCKWORKBIRD: design, animation, illustration &#187; javascript</title>
	<atom:link href="http://www.clockworkbird.com/site/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.clockworkbird.com/site</link>
	<description>Clockworkbird (aka Heather Smith) : Chicago based web designer, developer, animator, illustrator, artist and musician.</description>
	<lastBuildDate>Sat, 21 Jan 2012 23:17:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Shadowbox.js: Flash and Javascript doing a jig</title>
		<link>http://www.clockworkbird.com/site/2009/05/29/shadowboxjs-flash-and-javascript-doing-a-jig/</link>
		<comments>http://www.clockworkbird.com/site/2009/05/29/shadowboxjs-flash-and-javascript-doing-a-jig/#comments</comments>
		<pubDate>Fri, 29 May 2009 20:17:14 +0000</pubDate>
		<dc:creator>hey hey</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[custom function]]></category>
		<category><![CDATA[getURL]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[shadowbox]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.clockworkbird.com/blog/?p=261</guid>
		<description><![CDATA[Websites these days are simply layers of technologies stacked on top of one another. Every member of the digital sandwich doing what they do best. HTML structuring, CSS styling, Flash flashing, etc, etc&#8230; Sometimes they all play well together and sometimes it&#8217;s an alley way knife fight. I recently completed a project that involved creating [...]]]></description>
			<content:encoded><![CDATA[<p>Websites these days are simply layers of technologies stacked on top of one another. Every member of the digital sandwich doing what they do best. HTML structuring, CSS styling, Flash flashing, etc, etc&#8230;<br />
Sometimes they all play well together and sometimes it&#8217;s an alley way knife fight.</p>
<p>I recently completed a project that involved creating little flash widgets that would call a pop up using some sort of js lightbox library. Turns out this is not as simple as I thought it would be. After auditioning 10 (that&#8217;s right 10) lightboxes I finally emerged with a winner: <a href="http://www.shadowbox-js.com/">Shadowbox</a>.</p>
<p><strong>The issue:</strong><br />
Most lightboxes use the rel attribute to call the popup function. As far as I can tell, there is no way to insert a rel attribute inside of a getURL() in Actionscript. <em>To be honest, i had lots of other issues with the lightboxes I tried: browser capability, conflict with other js libraries I was using (jquery), inconsistent behavior, inability to load html pages (vs just images), etc.. etc..</em></p>
<p><strong>The solution:</strong><br />
<a href="http://www.shadowbox-js.com/">Shadowbox</a> allows you to set up a custom function for opening an instance of the popup. You simply feed that function name, proceeded by javascript: into the getURL() and voila!</p>
<div style=" padding: 10px; border: 1px solid #aaa;">
<strong>Step 1:</strong><br />
<a href="http://http://www.shadowbox-js.com/">Download Shadowbox</a> and buy a license! if you intend to use it for commercial purposes. Come on, y&#8217;all. It&#8217;s 20 bucks. Let&#8217;s support our awesome open source developers.</p>
<p><strong>Step 2:</strong><br />
Embed the scripts properly in your header:</p>
<div style="font-size:10px; padding: 5px;">&lt;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;scripts/shadowbox/shadowbox.css&#8221;&gt;<br />
&lt;script type=&#8221;text/javascript&#8221; src=&#8221;scripts/shadowbox/shadowbox.js&#8221;&gt;&lt;/script&gt;</div>
<p><strong>Step 3:</strong><br />
Initialize Shadowbox (with the required players &#8211; <a href="http://www.shadowbox-js.com/usage.html">read more here</a>) and then create a custom function in javascript in your html document. :</p>
<div style="font-size:9px; padding: 5px;">&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
Shadowbox.init({<br />
players:    ["html","iframe"]<br />
});<br />
function abrirSB(url)<br />
{<br />
Shadowbox.open({player: &#8220;iframe&#8221;, content: url, height: 570 , width: 850});<br />
};<br />
&lt;/script&gt;</div>
<p><strong>Step 4:</strong><br />
Create a flash piece with a getURL function applied to a button.</p>
<p><strong>Step 5:</strong><br />
Feed the properly formatted URL with the custom function name into the getURL:</p>
<div style="font-size:9px; padding: 5px;">button_btn.onRelease = function ()<br />
{<br />
getURL(&#8220;javascript:popUpFunction( &#8216;hello_world.html&#8217;);&#8221;)<br />
}</div>
<p><strong>Step 6:</strong><br />
Embed your flash object. I generally use SWFObject.</p>
<p><strong>Step 7:</strong><br />
Jump up and down and do a little dance when it works.
</div>
<p>I&#8217;ve even created a working sample for you, just to make it that much easier.</p>
<p><a href="http://www.clockworkbird.com/extras/flash_js_popup.zip"><strong>DOWNLOAD A COMPLETE TUTORIAL</strong></a></p>
<p>FYI: If you run it locally, Flash will try to verify that you have security clearance for that file. It&#8217;s not an error. It&#8217;s a security measure.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.clockworkbird.com/site/2009/05/29/shadowboxjs-flash-and-javascript-doing-a-jig/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

