<?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>Living In Minnesota &#187; Code</title>
	<atom:link href="http://livinginminnesota.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://livinginminnesota.com</link>
	<description></description>
	<lastBuildDate>Mon, 31 Jan 2011 03:44:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<cloud domain='livinginminnesota.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Dynamically resizing SWFObject to fit into a liquid or flexible layout</title>
		<link>http://livinginminnesota.com/2007/07/25/dynamically-resizing-swfobject-to-fit-into-a-liquid-or-flexible-layout/</link>
		<comments>http://livinginminnesota.com/2007/07/25/dynamically-resizing-swfobject-to-fit-into-a-liquid-or-flexible-layout/#comments</comments>
		<pubDate>Thu, 26 Jul 2007 00:48:31 +0000</pubDate>
		<dc:creator>christrygstad</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.livinginminnesota.com/2007/07/25/dynamically-resizing-swfobject-to-fit-into-a-liquid-or-flexible-layout/</guid>
		<description><![CDATA[I have a website with a flexible layout, I guess you would call it jello, so it resizes depending on the size of the window and resolution, making it difficult to determine what to pass as width and height variables. &#8230; <a href="http://livinginminnesota.com/2007/07/25/dynamically-resizing-swfobject-to-fit-into-a-liquid-or-flexible-layout/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p> I have a website with a flexible layout, I guess you would call it jello, so it resizes depending on the size of the window and resolution, making it difficult to determine what to pass as width and height variables. I wanted it to fit well into its containing &lt;div&gt;.</p>
<p>I couldn&#8217;t believe that there wasn&#8217;t already a solution for this, so I made my own. This solution uses a bit of php, javascript, and of course, flash. Please keep in mind that I cannot guarantee the reliability and/or quality of this solution, all I know is that it works for me, with IIS and PHP 5 (also works with PHP 4).<span id="more-46"></span></p>
<p>I tried to make this flexible, so the code that I inserted in the page that contains the page is:<br />
<code>&lt;div id="container"&gt;&lt;?php $flash_file = "flash_file.swf"; include("insert_flash.php");?&gt;&lt;/div&gt;</code><br />
And then I made an file called &#8216;insert_flash.php&#8217;. The code I put in was:<br />
<code> &lt;div id="flashcontent"&gt;<br />
&lt;p&gt;My alternate text in case the reader doesn't have flash.&lt;/p&gt;<br />
&lt;/div&gt;<br />
&lt;script type="text/javascript"&gt;<br />
if ("&lt;?php echo $flash_file;?&gt;" != ""){<br />
dwidth = document.getElementById('container').offsetWidth;<br />
var width = &lt;?php $headerDims = getimagesize($flash_file);$headerWidth =  $headerDims[0];echo $headerWidth;?&gt;;<br />
var height = &lt;?php echo $headerHeight = $headerDims[1];$headerHeight;?&gt;;<br />
if (width &gt; height) {<br />
var percentage = (dwidth / width);<br />
}<br />
else {<br />
var percentage = (dwidth / height);<br />
}<br />
}<br />
var width = Math.floor(width * percentage)-2;<br />
var height = Math.floor(height * percentage)-2;<br />
var so = new SWFObject("&lt;?php echo $flash_file;?&gt;", "mymovie",width,height, "6", "#ffffff");<br />
so.addParam("wmode", "opaque");<br />
so.write("flashcontent");<br />
window.onresize = function(){ //this is if the window gets resized by the user, so you don't have to reload the page on every reload<br />
dwidth = document.getElementById('container').offsetWidth;<br />
var width = &lt;?php $headerDims = getimagesize($flash_file);$headerWidth =  $headerDims[0];echo $headerWidth;?&gt;;<br />
var height = &lt;?php echo $headerHeight = $headerDims[1];$headerHeight;?&gt;;<br />
if (width &gt; height) {<br />
var percentage = (dwidth / width);<br />
}<br />
else {<br />
var percentage = (dwidth / height);<br />
}<br />
var width = Math.floor(width * percentage)-2;<br />
var height = Math.floor(height * percentage)-2;<br />
var so = new SWFObject("&lt;?php echo $flash_file;?&gt;", "mymovie",width,height, "6", "#ffffff");<br />
so.addParam("wmode", "opaque");<br />
so.write("flashcontent");<br />
}<br />
&lt;/script&gt;</code><br />
Try it out and play with it, the only thing I really experimented with was the &#8216;-2&#8242; when setting the width and height variables.  I&#8217;m sure this could be adjusted by setting the properties of the container and flashcontent divs.</p>
<p>Any improvements to suggest? I did try to put the &#8216;window.onresize&#8217; function into a separate function, so I wouldn&#8217;t have to reuse code, but it didn&#8217;t work, for some reason.</p>
]]></content:encoded>
			<wfw:commentRss>http://livinginminnesota.com/2007/07/25/dynamically-resizing-swfobject-to-fit-into-a-liquid-or-flexible-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reduce jumpiness in your Flash with some Actionscript</title>
		<link>http://livinginminnesota.com/2007/02/27/reduce-jumpiness-in-your-flash-with-some-actionscript/</link>
		<comments>http://livinginminnesota.com/2007/02/27/reduce-jumpiness-in-your-flash-with-some-actionscript/#comments</comments>
		<pubDate>Wed, 28 Feb 2007 05:06:56 +0000</pubDate>
		<dc:creator>christrygstad</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.livinginminnesota.com/reduce-jumpiness-in-your-flash-with-some-actionscript/</guid>
		<description><![CDATA[As I saw many sites begin to integrate flash elements into their site, I decided to make one too.Â  I wanted to make one that included navigational elements with rollover effects. As I was building the flash, I noticed that &#8230; <a href="http://livinginminnesota.com/2007/02/27/reduce-jumpiness-in-your-flash-with-some-actionscript/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As I saw many sites begin to integrate flash elements into their site, I decided to make one too.Â  I wanted to make one that included navigational elements with rollover effects. As I was building the flash, I noticed that the rollover effects were too &#8220;jumpy&#8221; or happened too fast. I thought by having a delay of a half-second would make it easier to navigate, and make it a bit more &#8220;professional-looking&#8221;. I attached this little bit of Actionscript toÂ  the navigational &#8220;symbols&#8221; in the Flash file.<span id="more-43"></span></p>
<pre>on(rollOver){displayTime = 30;

countDown = function(message){

displayTime--;

if (displayTime == 0){

clearInterval(timer);

gotoAndPlay('scene',1);

}

}

timer = setInterval(countDown, 15);

}

on(rollOut){clearInterval
<p style="direction: ltr"><wbr></wbr>(timer);}
</pre>
<p style="direction: ltr">So, if you look at the code above, and apply this to a symbol via actionscript, if you roll over the symbol, it will wait for a short period of time before flipping to the other scene (creatively called &#8216;scene&#8217; in the above code). Fool around with the 15 and 30 numbers in the above code to tweak the effect. Any questions?</p>
]]></content:encoded>
			<wfw:commentRss>http://livinginminnesota.com/2007/02/27/reduce-jumpiness-in-your-flash-with-some-actionscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

