<?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>Seagull Code Nodes &#187; AS3</title>
	<atom:link href="http://blog.joshuasiegal.com/tag/as3/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.joshuasiegal.com</link>
	<description></description>
	<lastBuildDate>Tue, 05 Oct 2010 06:25:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>jsFloater is top ten on google!</title>
		<link>https://blog.joshuasiegal.com/2010/jsfloater-is-top-ten-on-google/</link>
		<comments>https://blog.joshuasiegal.com/2010/jsfloater-is-top-ten-on-google/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 23:38:53 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[jsFloater]]></category>
		<category><![CDATA[liquid]]></category>

		<guid isPermaLink="false">http://blog.joshuasiegal.com/?p=189</guid>
		<description><![CDATA[Celebrating jsFloater&#8217;s appearance on the first result page in a google search for &#8220;Flash Liquid GUI&#8221;! We&#8217;re just psyched to be in a google result page with the likes of James O&#8217;Reilly and actionscript.org. Hooray!  If you haven&#8217;t checked out the code yet, by all means please do.]]></description>
			<content:encoded><![CDATA[<p>Celebrating jsFloater&#8217;s appearance on the first result  page in a <a title="google search for &quot;flash liquid gui&quot;" href="http://www.google.com/#hl=en&amp;q=flash+liquid+gui&amp;aq=f&amp;aqi=&amp;oq=&amp;fp=c26c79a56c95bda8" target="_blank">google search</a> for &#8220;Flash Liquid GUI&#8221;!</p>
<div id="attachment_193" class="wp-caption aligncenter" style="width: 410px"><a href="http://www.google.com/#hl=en&amp;q=flash+liquid+gui&amp;aq=f&amp;aqi=&amp;oq=&amp;fp=c26c79a56c95bda8" target="_blank"><img class="size-full wp-image-193  " style="border: 0pt none;" title="jsFloater in google's top ten results for flash liquid gui" src="http://blog.joshuasiegal.com/wp-content/uploads/2010/02/jsFloaterTopTen1.png" alt="Hangin at the Bottom" width="400" height="129" /></a><p class="wp-caption-text">Hangin at the Bottom</p></div>
<p>We&#8217;re just psyched to be in a google result page with the likes of James O&#8217;Reilly and actionscript.org.</p>
<p>Hooray!  If you haven&#8217;t checked out the code yet, by all means <a title="jsFloater" href="http://blog.joshuasiegal.com/jsFloater/" target="_blank">please do</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.joshuasiegal.com/2010/jsfloater-is-top-ten-on-google/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducting jsFloater</title>
		<link>https://blog.joshuasiegal.com/2009/introducing-jsfloater/</link>
		<comments>https://blog.joshuasiegal.com/2009/introducing-jsfloater/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 15:00:13 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[jsFloater]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[liquid]]></category>

		<guid isPermaLink="false">http://blog.joshuasiegal.com/?p=13</guid>
		<description><![CDATA[jsFloater is an Actionscript 3 class that allows you to &#8220;liquidify&#8221; (create liquid layout or liquid GUI for) your Flash site with a minimum of effort. Objects can be &#8220;floated&#8221; in a variety of ways, and with a great deal of flexibility: you can assign pads to your objects within the context of their float, [...]]]></description>
			<content:encoded><![CDATA[<p>jsFloater is an Actionscript 3 class that allows you to &#8220;liquidify&#8221; (create liquid layout or liquid GUI for) your Flash site with a minimum of effort.</p>
<p>Objects can be &#8220;floated&#8221; in a variety of ways, and with a great deal of flexibility: you can assign pads to your objects within the context of their float, and even use simple math to create custom interactive behaviors for your objects.  The package is extremely lightweight and flexible.</p>
<p>jsFloater also computes the centering math on your own objects for you.  Standard movieclip 0,0 top left registration is expected.</p>
<p>For an example, see the <a title="jsFloater example swf" href="http://joshuasiegal.com/jsFloater/" target="_blank">jsFloater example swf</a>, which contains an object for each available float method in the jsFloater class.  Mousing over these objects reveals their method, their float mode, and their current pixel x &#8211; y coordinates.  The example swf acts as a kind of visual API guide.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.joshuasiegal.com/2009/introducing-jsfloater/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Use jsFloater</title>
		<link>https://blog.joshuasiegal.com/2009/how-to-use-jsfloater/</link>
		<comments>https://blog.joshuasiegal.com/2009/how-to-use-jsfloater/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 14:32:40 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[jsFloater]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[liquid]]></category>

		<guid isPermaLink="false">http://blog.joshuasiegal.com/?p=62</guid>
		<description><![CDATA[To use jsFloater in your projects, download and extract the zip file which contains the example FLA file and the package with the AS script, which is the class itself.  If you want, you can open up the FLA example file and look at that code (and its comments) to get a working idea of [...]]]></description>
			<content:encoded><![CDATA[<p>To use jsFloater in your projects, download and extract the zip file which contains the example FLA file and the package with the AS script, which is the class itself.  If you want, you can open up the FLA example file and look at that code (and its comments) to get a working idea of how to use the class.</p>
<p>The class is located in the package, com &gt; seagull &gt; jsfloat.   Move the directory &#8220;seagull&#8221; into your &#8220;com&#8221; directory, and add the following line of code either in your appropriate package declaration(s) or, if you are using Actionscript 3 within your own FLA file, at the top of your script:</p>
<blockquote><p>import com.seagull.jsfloat.*;</p></blockquote>
<p>Before you start floating your elements, several other things must happen:</p>
<p><span id="more-62"></span></p>
<p>1. Put a listener on your stage, listening for the Event. RESIZE event.  <a title="Adobe Livedocs - Resize Event" href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Stage.html#event:resize" target="_blank">More on this here</a>.  Basically, this could look like so:</p>
<blockquote><p>stage.addEventListener(Event.RESIZE, floatStuff);</p></blockquote>
<p>This will call a function you create &#8211; in this example, it&#8217;s named &#8220;floatStuff&#8221;.</p>
<p>2. Align your stage to the top left and instruct it not to scale content.  The code is below:</p>
<blockquote><p>stage.scaleMode = StageScaleMode.NO_SCALE;<br />
stage.align = StageAlign.TOP_LEFT;</p></blockquote>
<p>Be careful with your publish / export settings using these stage properties &#8211; make sure they do not conflict.</p>
<p>3. Instantiate the jsFloat class.  To do this, simply create a new object of type jsFloat, and pass in your intended minimum stage height and minimum stage width.  In this example, we have created a design that requires a minimum stage size of 960 x 600.  Smaller than this, and our elements will start to crash together, so we instantiate the jsFloat class with our values:</p>
<blockquote><p>var floater:jsFloat = new jsFloat(960,600);</p></blockquote>
<p>You could also create variables to hold your minimum stage dimensions and pass those in as well, or even write code to destroy the floater object and re-instantiate it with a new minimum size, depending on some user interaction, etc.</p>
<p>Okay, now we&#8217;re ready to begin floating our elements.  For this example, we&#8217;ll use three made-up, generic variables called &#8220;sprite1&#8243;, &#8220;sprite2&#8243;, and &#8220;sprite3&#8243; that we want to float.  Now, we need to construct the function that will handle our resize event.</p>
<blockquote><p>function floatStuff(re:Event):void<br />
{<br />
var sW:Number = stage.stageWidth;<br />
var sH:Number = stage.stageHeight;<br />
floater.floatHorVer(sprite1,&#8221;center&#8221;,0,0,sW,sH);<br />
floater.floatHor(sprite2,&#8221;rightStrict&#8221;,20,20,sW,sH);<br />
floater.floatVer(sprite3,&#8221;bottomStrict&#8221;,100,10,sW,sH);<br />
}<em></p>
<p>Note: if you are copying the code above, you will have to re-do the double quotes so that Flash recognizes them.</em></p></blockquote>
<p>So, what&#8217;s going on there?  Let&#8217;s take it line by line.  The first line sets up our function (you could make this private, if you like) with the same name as that called by our earlier event listener.  Since it&#8217;s called by an event handler, it wants to receive an argument that represents the event, so in the parentheses, we create an event called &#8220;re&#8221; of type &#8220;Event&#8221;.  This function is not returning anything, hence, the &#8220;:void&#8221;.</p>
<p>The next line opens the function with the curly brackets.  In the two lines following that, I have created two variables of type &#8220;Number&#8221;, which will hold the current stage width and height values.  It&#8217;s important that these go inside the resize event handler, so that they will be re-computed every time the user resizes the browser window / stage.</p>
<p>Next, I call the &#8220;floatHorVer&#8221; method on my floater object, passing in our sprite1 object and using an align mode of &#8220;center&#8221; (aligning &#8220;sprite1&#8243; to the center of the stage), and I&#8217;ve given it an xPad and a yPad of 0, which means it will sit right in the middle.  Finally, I pass in the current stage width and stage height, contained in my sW and sH variables.</p>
<p>In the line following, I call the &#8220;floatHor&#8221; method on my floater object, and I pass in my second sprite.  I want this sprite to always be 20 pixels down from the top of the window and stay 20 px away from the right edge of the window, so I use the &#8220;rightStrict&#8221; mode, and I pass in a yStick of 20 (sticks the y value at 20) and an xPad of 20 (pads the resized x value by 20 from the edge).  Then I pass in the current stage width and height.</p>
<p>Finally, I call the &#8220;floatVer&#8221; method on my floater object, passing in my third sprite.  For this sprite, I want an alignment that will always be 100 pixels off of the leftmost window edge, and I want it to always be 10 pixels above the bottom of the window.  I pass in the &#8220;bottomStrict&#8221; mode, and an xStick of 100 (sticks the x value at 100), then a yPad of 10 (pads the y resized y value by 10 from the bottom).  Then I pass in the current stage width and height.</p>
<p>If you&#8217;re wondering why the floater object keeps getting re-used, think of it as a invisible gnome that is called into action when the window resizes &#8211; your calls to it represent a list of tasks for it to complete &#8211; so, even though we&#8217;re floating 3 different sprites, we&#8217;re calling the same floater object to accomplish all those tasks.  Also, the floater object will generate an x <span style="text-decoration: underline;">and</span> a y value for whatever object you pass into it.  Thus, do not attempt to use floatHor and floatVer on the same object, as the second one will over-write the first.  Use floatHorVer instead.</p>
<p>To close our function, we use the closing curly bracket.</p>
<p>Okay, we&#8217;re almost there!  We only need one more thing to get this running.  We want to call the resize handler (our floatStuff function) once when the script runs, because otherwise we&#8217;ll have to wait for the user to resize the window for any of this to take effect (and we don&#8217;t want to do that).</p>
<p>The only difference is that this time, the function is not being called by an event handler, so there&#8217;s no event to pass in.  Since we&#8217;re not actually using that required event argument within the function, we&#8217;ll just pass in nothing instead.  So, we have:</p>
<blockquote><p>floatStuff(null);</p></blockquote>
<p>That&#8217;s the basics!  For more on the various methods and alignment modes available to you using jsFloater, see <a title="the jsFloater API" href="http://blog.joshuasiegal.com/2009/the-jsfloater-api/">the jsFloater API</a>, <a title="the jsFloater visual API guide - example" href="http://joshuasiegal.com/jsFloater/" target="_blank">the jsFloater visual API guide / example</a>, and <a title="the jsFloater box model" href="http://blog.joshuasiegal.com/2009/the-jsfloater-box/">the jsFloater box model</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.joshuasiegal.com/2009/how-to-use-jsfloater/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The jsFloater API</title>
		<link>https://blog.joshuasiegal.com/2009/the-jsfloater-api/</link>
		<comments>https://blog.joshuasiegal.com/2009/the-jsfloater-api/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 13:43:46 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[jsFloater]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[liquid]]></category>

		<guid isPermaLink="false">http://blog.joshuasiegal.com/?p=29</guid>
		<description><![CDATA[The API for jsFloater consists of 3 publicly available methods: floatHor, floatVer, and &#8211; you guessed it &#8211; floatHorVer.  The first of these will float an object horizontally; the second will float an object vertically, and the third will float an object both horizontally and vertically. Because web browsers are anchored to the top left [...]]]></description>
			<content:encoded><![CDATA[<p>The API for jsFloater consists of 3 publicly available methods: floatHor, floatVer, and &#8211; you guessed it &#8211; floatHorVer.  The first of these will float an object horizontally; the second will float an object vertically, and the third will float an object both horizontally and vertically.</p>
<p>Because web browsers are anchored to the top left of the window, you may want to use a combination of these three methods to achieve your desired results.  jsFloater allows you to define a minimum stage size, so that your elements won&#8217;t crash together if the user squashes the page size down by dragging the browser window&#8217;s bottom right corner to the middle of the screen, for example.  This minimum stage size is passed to the class constructor on instantiation.</p>
<p>There is a visual guide to the API available both in the <a title="download jsFloater" href="http://blog.joshuasiegal.com/2009/download-jsfloater/" target="_blank">downloadable zip file</a> and also for <a title="jsFloater visual API example online" href="http://joshuasiegal.com/jsFloater/" target="_blank">browsing on this site</a>.  You can mouse over the various objects in the visual API guide to reveal what method has been used to float them, which align mode they are employing, and what their current pixel x &#8211; y coordinates are.</p>
<p>jsFloater allows you several types of floating, in addition to the ability to &#8220;pad&#8221; or &#8220;stick&#8221; your floats, as will be expained below.  The types of floating are proportional (based off of the difference between the minimum stage size and current stage size) or Strict, meaning based only on the current stage size.</p>
<p><strong>The methods:</strong></p>
<p><span id="more-29"></span></p>
<p><strong><span style="text-decoration: underline;"><br />
constructor</span></strong></p>
<p>public function jsFloat(sIW:uint, sIH:uint):void</p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;">returns</span>: nothing</p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;">parameters</span>:</p>
<p style="padding-left: 60px;"><strong><span style="color: #0000ff;">sIW</span></strong>:uint &#8211; stage Initial Width.  This is also the stage minimum width you define based on your designs.<br />
<strong><span style="color: #0000ff;">sIH</span></strong>:uint &#8211; stage Initial Height.  This is also the stage miniumum height you define based on your designs.</p>
<p style="padding-left: 60px;">Both of these parameters will be used to calculate values in the proportional float modes and will also set the values for browser window resizes that are smaller than your minimum.</p>
<p><strong><span style="text-decoration: underline;"><br />
floatHor</span></strong></p>
<p>public function floatHor(obj:Object, align:String,  yStick:int, xPad:int, sW:Number, sH:Number):void</p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;">returns</span>: nothing.</p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;">parameters</span>:</p>
<p style="padding-left: 60px;"><strong><span style="color: #0000ff;">obj:</span></strong>Object &#8211; the object passed to the method.  Can be sprite or movieclip as well.<span style="color: #0000ff;"><br />
<strong>align:</strong></span>String &#8211; the alignment mode.  Options are:<span style="color: #008080;"> </span><span style="color: #008080;"><br />
&#8220;left&#8221;</span> &#8211; aligns left, proportionate to minimum stage size<br />
<span style="color: #008080;"> &#8220;leftStrict&#8221;</span> &#8211; aligns left, based strictly on current window size<br />
<span style="color: #008080;">&#8220;right&#8221;</span> &#8211; aligns right, proportionate to minimum stage size<br />
<span style="color: #008080;">&#8220;rightStrict&#8221;</span> &#8211; aligns right, based strictly on current window size<br />
<span style="color: #008080;">&#8220;center&#8221;</span> &#8211; aligns center (horizontally) in the window<br />
<strong><span style="color: #0000ff;">yStick</span><span style="color: #0000ff;">:</span></strong>int &#8211; allows you to force the floated object to &#8220;stick&#8221; to a particular y value.  A horizontal float with a yStick of 0 will align vertically with the top of the browser window.  Negative values can be used, as well as your own math (provided it results in an integer).<br />
<strong><span style="color: #0000ff;">xPad</span><span style="color: #0000ff;">:</span></strong>int &#8211; allows you to pad your float values.  For example, if you are using an image that always needs to be 20 pixels from the right edge of the window, you would use the &#8220;rightStrict&#8221; mode and and xPad of 20.  Positive values for pads will move objects toward the center of the window (horiztontally, in this case), except when using the &#8220;center&#8221; mode, which moves positive values toward the right.  Negative values can be used, as well as your own math (provided it results in an integer).<br />
<strong><span style="color: #0000ff;">sW:</span></strong>Number &#8211; current stage width.<br />
<span style="color: #0000ff;"><strong>sH:</strong></span>Number &#8211; current stage height.</p>
<p><span style="text-decoration: underline;"><strong><br />
floatVer</strong></span></p>
<p>public function floatVer(obj:Object, align:String, xStick:int, yPad:int, sW:Number, sH:Number):void</p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;">returns</span>: nothing.</p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;">parameters</span>:</p>
<p style="padding-left: 60px;"><strong><span style="color: #0000ff;">obj:</span></strong>Object &#8211; the object passed to the method.  Can be sprite or movieclip as well.<span style="color: #0000ff;"><br />
<strong>align:</strong></span>String &#8211; the alignment mode.  Options are:<span style="color: #008080;"> </span><span style="color: #008080;"><br />
&#8220;top&#8221;</span> &#8211; aligns top, proportionate to minimum stage size<br />
<span style="color: #008080;"> &#8220;topStrict&#8221;</span> &#8211; aligns top, based strictly on current window size<br />
<span style="color: #008080;">&#8220;bottom&#8221;</span> &#8211; aligns bottom, proportionate to minimum stage size<br />
<span style="color: #008080;">&#8220;bottomStrict&#8221;</span> &#8211; aligns bottom, based strictly on current window size<br />
<span style="color: #008080;">&#8220;middle&#8221;</span> &#8211; aligns middle (vertically) in the window<br />
<strong><span style="color: #0000ff;">xStick</span><span style="color: #0000ff;">:</span></strong>int &#8211; allows you to force the floated object to &#8220;stick&#8221; to a particular x value.  A vertical float with a xStick of 0 will align with the left side of the browser window.  Negative values can be used, as well as your own math (provided it results in an integer).<br />
<strong><span style="color: #0000ff;">yPad</span><span style="color: #0000ff;">:</span></strong>int &#8211; allows you to pad your float values.  For example, if you are using an image that always needs to be 20 pixels from the bottom of the window, you would use the &#8220;bottomStrict&#8221; mode and and yPad of 20.  Positive values for pads will move objects toward the middle of the window (vertically, in this case), except when using the &#8220;middle&#8221; mode, which moves positive values to the bottom.  Negative values can be used, as well as your own math (provided it results in an integer).<br />
<strong><span style="color: #0000ff;">sW:</span></strong>Number &#8211; current stage width.<br />
<span style="color: #0000ff;"><strong>sH:</strong></span>Number &#8211; current stage height.</p>
<p><span style="text-decoration: underline;"><strong><br />
floatHorVer</strong></span></p>
<p>public function floatHorVer(obj:Object, stickMode:String, xPad:int, yPad:int, sW:Number, sH:Number):void</p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;">returns</span>: nothing.</p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;">parameters</span>:</p>
<p style="padding-left: 60px;"><strong><span style="color: #0000ff;">obj:</span></strong>Object &#8211; the object passed to the method.  Can be sprite or movieclip as well.<br />
<span style="color: #0000ff;"><strong>stickMode</strong></span>:String &#8211; analogous to the align parameter in the methods above.  Options are:<br />
<span style="color: #008000;">&#8220;center&#8221;</span> &#8211; aligns to the center (horizontally) and middle (vertically) of the window<br />
<span style="color: #008000;">&#8220;right&#8221;</span> &#8211; aligns vertically to the middle and horizontally to the right, proportionate to the minimum stage size<br />
<span style="color: #008000;">&#8220;rightStrict&#8221;</span> &#8211; aligns vertically to the middle and horizontally to the right, based strictly on current window size<br />
<span style="color: #008000;">&#8220;bottom&#8221;</span> &#8211; aligns horizontally to the center and vertically to the bottom, proportionate to the minimum stage size<br />
<span style="color: #008000;">&#8220;bottomStrict&#8221;</span> &#8211; aligns horizontally to the center and vertically to the bottom, based strictly on current window size<br />
<span style="color: #008000;">&#8220;bottomright&#8221;</span> &#8211; aligns to the bottom right, both proportionate to the minimum stage size<br />
<span style="color: #008000;">&#8220;bottomrightStrict&#8221;</span> &#8211; aligns to the bottom right, both based strictly on current window size<br />
<span style="color: #008000;">&#8220;bottomleft&#8221;</span> &#8211; aligns to the bottom left, proportionate to the minimum stage size<br />
<span style="color: #008000;">&#8220;left&#8221;</span> &#8211; aligns vertically to the middle and horizontally to the left, proportionate to the minimum stage size<br />
<span style="color: #008000;">&#8220;topleft&#8221;</span> &#8211; aligns to the top left, proportionate to the minimum stage size<br />
<span style="color: #008000;">&#8220;top&#8221;</span> &#8211; aligns horizontally to the center and vertically to the top, proportionate to the minimum stage size<br />
<span style="color: #008000;">&#8220;topright&#8221;</span> &#8211; aligns to the top right, proportionate to the minimum stage size<em><br />
Note: because the browser window is anchored to the top left, certain stickMode parameters for this method would be redundant.  For example, there is no topleftStrict, as that effect can be achieved with the floatHor method, taking an align mode of &#8220;leftStrict&#8221;.</em><strong><span style="color: #0000ff;"><br />
xPad</span><span style="color: #0000ff;">:</span></strong>int &#8211; allows you to pad your float values horizontally.<span style="color: #0000ff;"><strong><br />
yPad</strong></span>:int &#8211; allows you to pad your float values vertically.<br />
xPad and yPad are as described for the methods above.  Either can accept negative values and math that results in an integer, except that both will push objects toward the center (horiztonally) and middle (vertically) of the window when given positive values, unless the &#8220;center&#8221; mode is used, which will push positive values down and to the right.  For example, if you wanted two objects to float at the center of the screen, with one always offset from the other 20 pixels down and to the right, you would float the first using the floatHorVer method with xPad and yPad of 0 and 0, and float the second using the same method, with an xPad of 20 and a yPad of 20.<strong><span style="color: #0000ff;"><br />
sW:</span></strong>Number &#8211; current stage width.<br />
<span style="color: #0000ff;"><strong>sH:</strong></span>Number &#8211; current stage height.</p>
<p>For more, see <a title="How To Use jsFloater" href="http://blog.joshuasiegal.com/2009/how-to-use-jsfloater/">How To Use jsFloater</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.joshuasiegal.com/2009/the-jsfloater-api/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The jsFloater Box</title>
		<link>https://blog.joshuasiegal.com/2009/the-jsfloater-box/</link>
		<comments>https://blog.joshuasiegal.com/2009/the-jsfloater-box/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 12:25:22 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[jsFloater]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[liquid]]></category>

		<guid isPermaLink="false">http://blog.joshuasiegal.com/?p=95</guid>
		<description><![CDATA[As you may have learned from the API, the jsFloater class gives you a lot of flexibility in your floats, with &#8220;stick&#8221; values and padding available to add to your floating object x and y values.  I thought it might be useful, however, to break down some of the available methods in terms of a [...]]]></description>
			<content:encoded><![CDATA[<p>As you may have learned from the <a title="The jsFloater API" href="http://blog.joshuasiegal.com/2009/the-jsfloater-api/">API</a>, the jsFloater class gives you a lot of flexibility in your floats, with &#8220;stick&#8221; values and padding available to add to your floating object x and y values.  I thought it might be useful, however, to break down some of the available methods in terms of a box model, to help explain two different types of floating you can use: what we&#8217;re calling proportional and strict.</p>
<p>jsFloater requires you to define a minimum and width and height for your stage, so that you can take a given design comp and figure out how small the browser window can get before the objects begin crashing into each other and/or overlapping in undersirable ways.  This is an issue common to liquid GUIs / layouts, one which jsFloater lets you fix.  But, you may not always want your elements to float based upon the very edges of the current browser window: if, for example, your design comp figures at a minimum window size of 800 x 600, you may want your elements to float somewhere between the minimum value and the edge of the window.  You could accomplish that with typical liquid GUI layout types and a bunch of your own math &#8211; or, you could let jsFloater do it for you, using the proportional float modes available.</p>
<p>We&#8217;ll examine the basic boxes in a moment, but first let&#8217;s recap the horizontal and vertical floats.  The images below are all taken from the <a title="The jsFloater visual API example" href="http://joshuasiegal.com/jsFloater/" target="_blank">jsFloater visual API example</a>, which can also be exported from the FLA file included in the download.  It may help you to have the visual API guide open while you read through this example, so you can experiment and see how the objects move and react.</p>
<p>First, let&#8217;s look at the available align modes for the floatVer (vertical) method.</p>
<p><span id="more-95"></span></p>
<div id="attachment_109" class="wp-caption aligncenter" style="width: 522px"><img class="size-full wp-image-109 " title="jsFloater Vertical align modes" src="http://blog.joshuasiegal.com/wp-content/uploads/2009/12/floater_verAlign2.png" alt="jsFloater Vertical align modes" width="512" height="286" /><p class="wp-caption-text">jsFloater Vertical align modes</p></div>
<p>As you can see, one of the objects is floating directly in the middle (vertically), one each is floating at the very top and bottom (strict), and two are floating somewhere that represents the a ratio of difference between the minimum height (height of the dotted box) and the current window height.  Those two are using the proportional modes.</p>
<p>Let&#8217;s look at the floats for the floatHor (horizontal) method:</p>
<div id="attachment_110" class="wp-caption aligncenter" style="width: 522px"><img class="size-full wp-image-110 " title="jsFloater Horizontal align modes" src="http://blog.joshuasiegal.com/wp-content/uploads/2009/12/floater_horAlign2.png" alt="jsFloater Horizontal align modes" width="512" height="286" /><p class="wp-caption-text">jsFloater Horizontal align modes</p></div>
<p>Although the left-most horiztonally floating object is currently obscured by the top-most vertically floating object, you should be able to see here how the horizontal mode is analogous to the vertical mode: one object aligned perfectly center, two strictly aligned left and right, and two floating proportionally between the minimum width (width of the dotted box) and current window width.</p>
<p>So, here is what the proportional box looks like, using nine floating modes (including the object at center-middle):</p>
<div id="attachment_111" class="wp-caption aligncenter" style="width: 522px"><img class="size-full wp-image-111 " title="jsFloater proportional box" src="http://blog.joshuasiegal.com/wp-content/uploads/2009/12/floater_propbox1.png" alt="jsFloater proportional box" width="512" height="286" /><p class="wp-caption-text">jsFloater proportional box</p></div>
<p>All of the nine objects being floated in the above box are using the floatHorVer method, width proportional align modes.  This proportional align is based on the difference between the minimum value and the current browser window size, so that elements float out into the browser space proportionally, but to not have to be stuck to the edges of the window, or to a fixed distance from the edges of the window.</p>
<p>Of course, you can combine the different float methods and modes however you like.  One possible use might be using proportional floats of the floatHorVer method for your right- and bottom-most objects, and using other floats for your left- and top-most items, for example.  It&#8217;s up to you and your creativity.</p>
<p>Now, let&#8217;s look at the strict box:</p>
<div id="attachment_112" class="wp-caption aligncenter" style="width: 522px"><img class="size-full wp-image-112 " title="jsFloater strict box" src="http://blog.joshuasiegal.com/wp-content/uploads/2009/12/floater_strictbox1.png" alt="jsFloater strict box" width="512" height="286" /><p class="wp-caption-text">jsFloater strict box</p></div>
<p>Notice, in the example above, that we&#8217;re now using a combination of the floatVer, floatHor, and floatHorVer methods to achieve a box that goes to the very edges of the current browser window size.  The reason for this can be explained using a simple example: look at the bottom left corner of the box.  That object only needs to float vertically, as the whole browser window is anchored to the top and the left.</p>
<p>Once again, you can assign particular x and y &#8220;stick&#8221; values to your vertically and horizontally floated objects, respectively.  You can pad the float of any object and also use your own math to create some custom behaviors on browser resize.  Hope you have fun experimenting with the various methods and modes.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.joshuasiegal.com/2009/the-jsfloater-box/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Math and jsFloater &#8211; dynamic drop shadow</title>
		<link>https://blog.joshuasiegal.com/2009/math-and-jsfloater-dynamic-drop-shadow/</link>
		<comments>https://blog.joshuasiegal.com/2009/math-and-jsfloater-dynamic-drop-shadow/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 11:20:12 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[jsFloater]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[liquid]]></category>
		<category><![CDATA[math]]></category>

		<guid isPermaLink="false">http://blog.joshuasiegal.com/?p=128</guid>
		<description><![CDATA[So, in other posts, we&#8217;ve talked about jsFloater being able to take your computed integer values and use them to create some dynamic effects based on the browser resizing. Here is a really simple example: it&#8217;s a drop shadow that changes its distance based on the size of the window, and as you resize the [...]]]></description>
			<content:encoded><![CDATA[<p>So, in other posts, we&#8217;ve talked about jsFloater being able to take your computed integer values and use them to create some dynamic effects based on the browser resizing.</p>
<p>Here is a really simple example: it&#8217;s a <a title="jsFloater - dynamic dropshadow example" href="http://joshuasiegal.com/jsFloater/dropshadow/" target="_blank">drop shadow that changes its distance based on the size of the window</a>, and as you resize the window the distance changes as well.  Of course, it&#8217;s up to your imagination to come up with other uses, but this is a simple example that gets to the point.</p>
<p><span id="more-128"></span></p>
<p>To accomplish this, I only needed to add a couple of lines of code to our existing resize event handler from the <a title="How To Use jsFloater" href="http://blog.joshuasiegal.com/2009/how-to-use-jsfloater/" target="_self">How To Use jsFloater</a> documentation:</p>
<blockquote><p>function floatStuff(re:Event):void<br />
{<br />
var sW:Number = stage.stageWidth;<br />
var sH:Number = stage.stageHeight;<br />
var shadW:int = Math.floor(sW/120);<br />
var shadH:int = Math.floor(sH/60);<br />
floater.floatHorVer(rembrandt,&#8221;center&#8221;,0,0,sW,sH);<br />
floater.floatHorVer(shadow,&#8221;center&#8221;,shadW,shadH,sW,sH);<br />
}</p>
<p><em>Note: if you are copying the code above, you will have to re-do the double quotes so that Flash recognizes them.</em></p></blockquote>
<p>As you can see, I&#8217;ve got two objects that I&#8217;m floating, with instance names of &#8220;rembrandt&#8221; and &#8220;shadow&#8221; &#8211; pretty obvious what&#8217;s going on there.  But if you look above, you&#8217;ll also see that I&#8217;ve added two variables of type integer, which take the stage width and height, divide each by some values that I think work well, and floor each result into an integer.</p>
<p>Both floats are using the floatHorVer method with an alignment mode of &#8220;center&#8221;, and the only difference between the picture of rembrant and its shadow is that the picture is always floating exactly center, while the shadow is being padded &#8211; dynamically &#8211; based upon a fraction of what the current browser size is.</p>
<p>The result: a dynamic drop shadow that seems alter its light source <a title="wikipedia: Throw(projector)" href="http://en.wikipedia.org/wiki/Throw_%28projector%29" target="_blank">throw</a> depending on the size of the window.  One possible use for this is making sure that the drop shadow doesn&#8217;t get cut off if the user resizes the browser window really small.</p>
<p>Of course, this is a simple example, but you can get as crazy with it as you like.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.joshuasiegal.com/2009/math-and-jsfloater-dynamic-drop-shadow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Download jsFloater</title>
		<link>https://blog.joshuasiegal.com/2009/download-jsfloater/</link>
		<comments>https://blog.joshuasiegal.com/2009/download-jsfloater/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 10:13:11 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[jsFloater]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://blog.joshuasiegal.com/?p=135</guid>
		<description><![CDATA[» Download jsFloater (zip) &#160; Thanks for downloading my code!  Hope it brings you lots of fun and saves you a bunch of work. If you like it, please spread the word. If you haven&#8217;t already, I strongly encourage you to check out the API and the How-To page. Thanks! Josh]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;">» <a title="Download jsFloater zip file" href="http://joshuasiegal.com/jsFloater/jsFloater.zip">Download jsFloater (zip)</a></p>
<p style="text-align: center;"><a href="http://creativecommons.org/licenses/by/3.0/" target="_blank"><img class="aligncenter" title="Released under Creative Commons license" src="http://i.creativecommons.org/l/by/3.0/88x31.png" alt="Released under Creative Commons license" width="88" height="31" border="0" /></a></p>
<p>&nbsp;</p>
<p>Thanks for downloading my code!  Hope it brings you lots of fun and saves you a bunch of work.</p>
<p>If you like it, please spread the word.</p>
<p>If you haven&#8217;t already, I strongly encourage you to check out the <a title="The jsFloater API" href="http://blog.joshuasiegal.com/2009/the-jsfloater-api/" target="_self">API</a> and the <a title="How To Use jsFloater" href="http://blog.joshuasiegal.com/2009/how-to-use-jsfloater/">How-To page</a>.</p>
<p>Thanks!</p>
<p>Josh</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.joshuasiegal.com/2009/download-jsfloater/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jsFloater FAQ</title>
		<link>https://blog.joshuasiegal.com/2009/jsfloater-faq/</link>
		<comments>https://blog.joshuasiegal.com/2009/jsfloater-faq/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 09:22:54 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[jsFloater]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[liquid]]></category>

		<guid isPermaLink="false">http://blog.joshuasiegal.com/?p=146</guid>
		<description><![CDATA[How does jsFloater differ from other liquid GUI classes for AS3? In two main ways: (1) jsFloater requires you to define a minimum area for your floating, so that the objects in your liquid layout will never crash together in undesired ways; (2) jsFloater lets you pad your floating objects, gives you several modes to [...]]]></description>
			<content:encoded><![CDATA[<p><strong>How does jsFloater differ from other liquid GUI classes for AS3?</strong></p>
<p style="padding-left: 30px;">In two main ways: (1) jsFloater requires you to define a minimum area for your floating, so that the objects in your liquid layout will never crash together in undesired ways; (2) jsFloater lets you pad your floating objects, gives you several modes to use, and also lets you use your own math to create enless dynamic effects.</p>
<p><strong>How is jsFloater released?  Can I adapt jsFloater source code?</strong></p>
<p style="padding-left: 30px;">jsFloater is released under a <a title="Creative Commons Attribution 3.0 Unported license" href="http://creativecommons.org/licenses/by/3.0/" target="_blank">Creative Commons Attribution 3.0 Unported license</a> &#8211; meaning, you may use and/or adapt the source code however you like, provided you give attribution to the author.  Links back to this site are always appreciated.</p>
<p><span id="more-146"></span></p>
<p><strong>Why is there not an AS2 version of jsFloater?</strong></p>
<p style="padding-left: 30px;">Sorry, I don&#8217;t really work in AS2 very much.  I&#8217;m seeing someone else now, someone with an incremented version number.</p>
<p><strong>I don&#8217;t get this package and class business.  Why can&#8217;t I just put the jsFloater code in my timeline?</strong></p>
<p style="padding-left: 30px;">Having a package and class means better performance and, of course, the ability to instantiate and reuse the jsFloater object &#8211; it&#8217;s part of what makes jsFloater work.   For a great tutorial on how classes are handled in AS3, see <a title="kirpua AS3 classes tutorial" href="http://www.kirupa.com/developer/as3/classes_as3_pg1.htm" target="_blank">this kirupa tutorial</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.joshuasiegal.com/2009/jsfloater-faq/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Follow You!</title>
		<link>https://blog.joshuasiegal.com/2009/follow-you/</link>
		<comments>https://blog.joshuasiegal.com/2009/follow-you/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 20:43:34 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[filters]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[particles]]></category>

		<guid isPermaLink="false">http://blog.joshuasiegal.com/?p=6</guid>
		<description><![CDATA[No, it&#8217;s not an annoying javascript mouse-follower; it&#8217;s a little bit of actionscript (3) I wrote to test particle generation, color theming and randomization, and interactive filters. Hope you enjoy.]]></description>
			<content:encoded><![CDATA[<p>No, it&#8217;s not an annoying javascript mouse-follower; it&#8217;s a little bit of actionscript (3) I wrote to test particle generation, color theming and randomization, and interactive filters.</p>
<p><a title="Followers Experiment" href="http://joshuasiegal.com/followers/" target="_blank">Hope you enjoy</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.joshuasiegal.com/2009/follow-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
