<?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>Deviouswork</title>
	<atom:link href="http://www.deviouswork.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.deviouswork.com</link>
	<description>Flash development for hire</description>
	<lastBuildDate>Thu, 11 Feb 2010 07:48:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>URLShortener package</title>
		<link>http://www.deviouswork.com/2009/09/17/urlshortener-package/</link>
		<comments>http://www.deviouswork.com/2009/09/17/urlshortener-package/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 20:04:12 +0000</pubDate>
		<dc:creator>Joakim Roos</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Labs]]></category>
		<category><![CDATA[Bit.ly]]></category>
		<category><![CDATA[Is.gd]]></category>
		<category><![CDATA[J.mp]]></category>
		<category><![CDATA[Tr.im]]></category>
		<category><![CDATA[URL-shorteners]]></category>

		<guid isPermaLink="false">http://www.deviouswork.com/?p=376</guid>
		<description><![CDATA[Services included at the moment:
Bit.ly (BitlyService)
J.mp	(JmpService)
Is.gd (IsgdService)
Tr.im (TrimService);


import com.deviouswork.http.url.*;

var us:URLShortener = new URLShortener(BitlyService);

//Only needed for Bit.ly and J.mp
us.service.version = &#039;2.0.1&#039;;
us.service.login = &#039;bitlyapidemo&#039;;
us.service.key = &#039;R_0da49e0a9118ff35f52f629d2d71bf07&#039;;
//End Bit.ly/J.mp part

us.shorten(&#039;http://www.deviouswork.com/labs/&#039;);
us.addEventListener(Event.COMPLETE, complete, false, 0, true);

function complete(event:Event):void {
	us.removeEventListener(Event.COMPLETE, complete);
	trace(us.shortURL);
}

Update
Moved the package over to Github
http://github.com/deviouswork/URLshortener
]]></description>
			<content:encoded><![CDATA[<p>Services included at the moment:<br />
Bit.ly (BitlyService)<br />
J.mp	(JmpService)<br />
Is.gd (IsgdService)<br />
Tr.im (TrimService);</p>
<pre class="brush: as3">

import com.deviouswork.http.url.*;

var us:URLShortener = new URLShortener(BitlyService);

//Only needed for Bit.ly and J.mp
us.service.version = &#039;2.0.1&#039;;
us.service.login = &#039;bitlyapidemo&#039;;
us.service.key = &#039;R_0da49e0a9118ff35f52f629d2d71bf07&#039;;
//End Bit.ly/J.mp part

us.shorten(&#039;http://www.deviouswork.com/labs/&#039;);
us.addEventListener(Event.COMPLETE, complete, false, 0, true);

function complete(event:Event):void {
	us.removeEventListener(Event.COMPLETE, complete);
	trace(us.shortURL);
}
</pre>
<p><strong>Update</strong><br />
Moved the package over to Github<br />
<a href="http://github.com/deviouswork/URLshortener">http://github.com/deviouswork/URLshortener</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.deviouswork.com/2009/09/17/urlshortener-package/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Circle Preloader</title>
		<link>http://www.deviouswork.com/2009/07/15/circle-preloader/</link>
		<comments>http://www.deviouswork.com/2009/07/15/circle-preloader/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 09:25:36 +0000</pubDate>
		<dc:creator>Joakim Roos</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Labs]]></category>
		<category><![CDATA[Gradient]]></category>
		<category><![CDATA[Preloader]]></category>

		<guid isPermaLink="false">http://www.deviouswork.com/?p=333</guid>
		<description><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_CirclePreloader_880029292"
			class="flashmovie"
			width="35"
			height="35">
	<param name="movie" value="http://www.deviouswork.com/blog/wp-content/uploads/2009/07/CirclePreloader.swf" />
	<param name="bgcolor" value="#ffffff" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.deviouswork.com/blog/wp-content/uploads/2009/07/CirclePreloader.swf"
			name="fm_CirclePreloader_880029292"
			width="35"
			height="35">
		<param name="bgcolor" value="#ffffff" />
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
Class and example after the jump.
Example:

import com.deviouswork.display.preloaders.CirclePreloader;
var t:CirclePreloader = new CirclePreloader(0x160101, 30);
t.x = t.width*.5;
t.y = t.height*.5;
addChild(t);

Class:

/**
 * com.deviouswork.display.preloaders.CirclePreloader
 * @version 1.0.0
 * @author Joakim Roos  - http://www.deviouswork.com
 * Copyright � 2009 Deviouswork. All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining [...]]]></description>
			<content:encoded><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_CirclePreloader_456629893"
			class="flashmovie"
			width="35"
			height="35">
	<param name="movie" value="http://www.deviouswork.com/blog/wp-content/uploads/2009/07/CirclePreloader.swf" />
	<param name="bgcolor" value="#ffffff" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.deviouswork.com/blog/wp-content/uploads/2009/07/CirclePreloader.swf"
			name="fm_CirclePreloader_456629893"
			width="35"
			height="35">
		<param name="bgcolor" value="#ffffff" />
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
Class and example after the jump.<span id="more-333"></span><br />
Example:</p>
<pre class="brush: as3">
import com.deviouswork.display.preloaders.CirclePreloader;
var t:CirclePreloader = new CirclePreloader(0x160101, 30);
t.x = t.width*.5;
t.y = t.height*.5;
addChild(t);
</pre>
<p>Class:</p>
<pre class="brush: as3">
/**
 * com.deviouswork.display.preloaders.CirclePreloader
 * @version 1.0.0
 * @author Joakim Roos  - http://www.deviouswork.com
 * Copyright � 2009 Deviouswork. All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the &quot;Software&quot;), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */
package com.deviouswork.display.preloaders {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.utils.Timer;

	/**
	 * CirclePreloader
	 */
	public class CirclePreloader extends Sprite {

		private var _color : int;
		private var _radius:int;
		private var _thickness : Number;
		private var _density : uint;
		private var _slicesContainer_sprite : Sprite;
		private var _timer:Timer;

		public function CirclePreloader(color:int = 0x000000, radius:int = 30, thickness:uint = 7) {
			super();
			_color = color;
			_radius = radius - thickness;
			_thickness = thickness*.5;
			_density = _radius * 4;
			_draw();
		}

		private function _draw():void {
			_slicesContainer_sprite = new Sprite();
			var i:int = 0;
			var degrees : int = 360 / _density;
			while (i &lt; _density) {
				var slice:Sprite = _getSlice();
				slice.rotation = 360 / _density * i;
				if (360 / _density * i &gt;= 2) {
                	slice.alpha = 1 / degrees * (_density - i);
           		} else {
					degrees = _density - i;
                }
				_slicesContainer_sprite.addChild(slice);
				i++;
			}
			addChild(_slicesContainer_sprite);
			addEventListener(Event.ADDED_TO_STAGE, _onAddedToStageEvent);
		}

		private function _getSlice():Sprite {
			var slice:Sprite = new Sprite();
			slice.graphics.beginFill(_color);
			slice.graphics.drawCircle(-_thickness * .5, -_radius * .5, _thickness);
			slice.graphics.endFill();
			return slice;
		}

		private function _onAddedToStageEvent(event:Event):void {
			removeEventListener(Event.ADDED_TO_STAGE, _onAddedToStageEvent);
			addEventListener(Event.REMOVED_FROM_STAGE, _onRemovedFromStageEvent);
			_timer = new Timer(10);
			_timer.addEventListener(TimerEvent.TIMER, _onTimerEvent);
			_timer.start();
		}

		private function _onRemovedFromStageEvent(event:Event):void {
			removeEventListener(Event.REMOVED_FROM_STAGE, _onRemovedFromStageEvent);
			addEventListener(Event.ADDED_TO_STAGE, _onAddedToStageEvent);
			_timer.reset();
			_timer.removeEventListener(TimerEvent.TIMER, _onTimerEvent);
			_timer = null;
		}

		private function _onTimerEvent(event:TimerEvent):void {
			rotation = (rotation - (360 / _density)) % 360;
		}
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.deviouswork.com/2009/07/15/circle-preloader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slotmachine effect</title>
		<link>http://www.deviouswork.com/2009/07/10/slotmachine-effect/</link>
		<comments>http://www.deviouswork.com/2009/07/10/slotmachine-effect/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 10:31:40 +0000</pubDate>
		<dc:creator>Joakim Roos</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Labs]]></category>
		<category><![CDATA[Effect]]></category>
		<category><![CDATA[One Armed Bandit]]></category>
		<category><![CDATA[Slotmachine]]></category>

		<guid isPermaLink="false">http://www.deviouswork.com/?p=326</guid>
		<description><![CDATA[Dependencies &#8211; TweenLite
Example:

var sm:SlotMachine = new SlotMachine(&#039;€15533&#039;, font, 35, &#039;0123456789€&#039;);
addChild(sm);
sm.addEventListener(Event.COMPLETE, _complete);
sm.render();

function _complete(aEvent:Event):void {
	trace(&#34;SlotMachine COMPLETE&#34;);
}



/**
 * com.deviouswork.display.effects.SlotMachine
 * @version 1.0.0
 * @author Joakim Roos  - http://www.deviouswork.com
 * Copyright � 2009 Deviouswork. All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated [...]]]></description>
			<content:encoded><![CDATA[<p>Dependencies &#8211; <a href="http://blog.greensock.com/tweenliteas3/">TweenLite</a></p>
<p>Example:</p>
<pre class="brush: as3">
var sm:SlotMachine = new SlotMachine(&#039;€15533&#039;, font, 35, &#039;0123456789€&#039;);
addChild(sm);
sm.addEventListener(Event.COMPLETE, _complete);
sm.render();

function _complete(aEvent:Event):void {
	trace(&quot;SlotMachine COMPLETE&quot;);
}
</pre>
<p><span id="more-326"></span>
<pre class="brush: as3">
/**
 * com.deviouswork.display.effects.SlotMachine
 * @version 1.0.0
 * @author Joakim Roos  - http://www.deviouswork.com
 * Copyright � 2009 Deviouswork. All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the &quot;Software&quot;), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */
package com.deviouswork.display.effects {
	import flash.events.Event;
	import gs.TweenLite;
	import gs.plugins.BlurFilterPlugin;
	import gs.plugins.TweenPlugin;

	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.events.TimerEvent;
	import flash.text.Font;
	import flash.utils.Timer;

	[Event(name=&quot;complete&quot;, type=&quot;flash.events.Event&quot;)]

	/**
	 * SlotMachine
	 */
	public class SlotMachine extends Sprite {

		public function get characterRange() : String {	return _characterRange_str; }
		public function set characterRange(aInput_str : String):void {	_characterRange_str = aInput_str; }
		private var _characterRange_str : String;

		private var _slotText_str : String;
		private var _bcContainer_mc : Sprite;
		private var _currentChar_int : Number;

		public function SlotMachine(aSlotText:String,  aFont:Font = null, aSize:uint = 12, aCharacterRange:String = &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890&quot;) {

			TweenPlugin.activate([BlurFilterPlugin]);
			characterRange = aCharacterRange;
			_slotText_str = aSlotText;
			var reverse_str:String = _slotText_str.split(&#039;&#039;).reverse().join(&#039;&#039;);
			var i: uint = reverse_str.length;
			var ox:Number = 0;
			_bcContainer_mc = new Sprite();
			addChild(_bcContainer_mc);
			while(i--) {
				var bc:BitmapCharacter = new BitmapCharacter(characterRange, aSize, aFont);
				bc.name = &quot;BitmapCharacter_&quot; + reverse_str.charAt(i) +&quot;_&quot; + Math.random();
				_bcContainer_mc.addChild(bc);
				bc.x = ox;
				bc.getChildByName(&quot;bmp_&quot; + reverse_str.charAt(i)).visible = true;
				ox = bc.x + bc.width;
				bc.getChildByName(&quot;bmp_&quot; + reverse_str.charAt(i)).visible = false;
			}
			var bcMask_mc:Sprite = new Sprite();
			addChild(bcMask_mc);
			with(bcMask_mc.graphics) {
				beginFill(0x000000, .1);
				drawRect(0, 0, _bcContainer_mc.width, _bcContainer_mc.height);
				endFill();
			}
			_bcContainer_mc.mask = bcMask_mc;
		}

		public function render():void {

			_currentChar_int = 0;
			var chars: int = characterRange.length;

			var t:Timer = new Timer(100, chars);
			t.addEventListener(TimerEvent.TIMER, _updateAnimation);
			t.addEventListener(TimerEvent.TIMER_COMPLETE, _endAnimation);
			t.start();
		}

		private function _updateAnimation(aEvent_te:TimerEvent):void {

			for(var i:int = 0; i &lt; _bcContainer_mc.numChildren; i++) {
				var bc:BitmapCharacter = _bcContainer_mc.getChildAt(i) as BitmapCharacter;
				var	bmp:Bitmap = bc.getChildAt(_currentChar_int) as Bitmap;
				bmp.y = bmp.height;
				bmp.visible = true;
				if(bc.currentCharacter != null) {
					TweenLite.to(bc.currentCharacter, 0.1, {y:-bc.currentCharacter.height, delay:i*.1, overwrite:false});
				}
				TweenLite.to(bmp, 0.1, {y:0,blurFilter:{blurY:10}, delay:i*.1, overwrite:false});
				bc.currentCharacter = bmp;
			}
			if(_currentChar_int &lt; characterRange.length-1) _currentChar_int++;
			else _currentChar_int = 0;

		}

		private function _endAnimation(aEvent_te:TimerEvent):void {
			for(var i:int = 0; i &lt; _bcContainer_mc.numChildren; i++) {
				var bc:BitmapCharacter = _bcContainer_mc.getChildAt(i) as BitmapCharacter;
				TweenLite.to(bc.currentCharacter, 0.1, {y:-bc.currentCharacter.height, delay:0, overwrite:true});
				for(var j:int = 0; j &lt; characterRange.length; j++) {
					var delay_num:Number = i*.1 + j*.1;
					var	bmp:Bitmap = bc.getChildAt(j) as Bitmap;
					TweenLite.to(bc.currentCharacter, 0.1, {y:-bc.currentCharacter.height, delay:delay_num, overwrite:false});
					bc.currentCharacter = bmp;
					if(bmp.name == &quot;bmp_&quot;+ _slotText_str.charAt(i)) {
						TweenLite.to(bmp, 0.1, {y:0, blurFilter:{blurY:0}, delay:delay_num, overwrite:false});
						break;
					} else {
						TweenLite.to(bmp, 0.1, {y:0,blurFilter:{blurY:10}, delay:delay_num, overwrite:false});

					}
				}
			}

			var t:Timer = aEvent_te.target as Timer;
			t.stop();
			t.removeEventListener(TimerEvent.TIMER_COMPLETE, _endAnimation);
			t = null;
			TweenLite.delayedCall(delay_num, _dispatchCompleteEvent);

		}

		private function _dispatchCompleteEvent():void {
			dispatchEvent(new Event(Event.COMPLETE));
		}
	}
}

import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.text.Font;
import flash.text.FontStyle;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;

internal class BitmapCharacter extends Sprite { 

	public function get currentCharacter() : Bitmap {	return _currentCharacter_bitmap; }
	public function set currentCharacter(aInput_bitmap : Bitmap):void {	_currentCharacter_bitmap = aInput_bitmap; }
	private var _currentCharacter_bitmap : Bitmap;

	public function BitmapCharacter(aCharacterRange:String, aSize:uint, aFont:Font = null):void {

		var fmt:TextFormat = new TextFormat();
		fmt.font = &quot;_sans&quot;;
		if(aFont) {
			fmt.font = aFont.fontName;
			switch (aFont.fontStyle) {
				case FontStyle.BOLD:
					fmt.bold = true;
					break;
				case FontStyle.BOLD_ITALIC:
					fmt.bold = true;
					fmt.italic = true;
					break;
				case FontStyle.ITALIC:
					fmt.italic = true;
					break;
			}
		}
		fmt.size = aSize;
		fmt.color = 0xFFFFFF;

		var tf:TextField = new TextField();
		tf.width = 1;
		tf.height = 1;
		tf.autoSize = TextFieldAutoSize.LEFT;
		tf.selectable = false;
		tf.defaultTextFormat = fmt;
		if(aFont) tf.embedFonts = true;
		addChild(tf);		

		var i : int = aCharacterRange.length;
		while(i--) {
			tf.text = aCharacterRange.charAt(i);
			var bmd:BitmapData = new BitmapData(tf.width, tf.height, true, 0x000000);
			var bmp:Bitmap = new Bitmap(bmd, &quot;auto&quot;, true);
			bmp.y = 100;
			bmp.name = &quot;bmp_&quot; + aCharacterRange.charAt(i);
			bmp.visible = false;
			addChild(bmp);
			bmd.draw(this);
		}
		removeChild(tf);
		tf = null;
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.deviouswork.com/2009/07/10/slotmachine-effect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ordered Lists in TextField.htmlText</title>
		<link>http://www.deviouswork.com/2009/04/21/ordered-lists-in-textfieldhtmltext/</link>
		<comments>http://www.deviouswork.com/2009/04/21/ordered-lists-in-textfieldhtmltext/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 12:21:59 +0000</pubDate>
		<dc:creator>Joakim Roos</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Labs]]></category>
		<category><![CDATA[htmltext]]></category>
		<category><![CDATA[li]]></category>
		<category><![CDATA[ul]]></category>

		<guid isPermaLink="false">http://www.deviouswork.com/?p=240</guid>
		<description><![CDATA[One thing thats kept bugging me with TextField.htmlText was the lack of support for ordered list (&#60;ol&#62;&#60;li&#62;&#60;/li&#62;&#60;/ol&#62;) in a textfield with htmlText applied to it. I decided to write a simple class that strips a html string from the (&#60;ol&#62;&#60;li&#62;&#60;/li&#62;&#60;/ol&#62;) and arrange the list(s) in numerical order with tabs instead. I know this isn&#8217;t the [...]]]></description>
			<content:encoded><![CDATA[<p>One thing thats kept bugging me with TextField.htmlText was the lack of support for ordered list <strong>(&lt;ol&gt;&lt;li&gt;&lt;/li&gt;&lt;/ol&gt;)</strong> in a textfield with htmlText applied to it. I decided to write a simple class that strips a html string from the <strong>(&lt;ol&gt;&lt;li&gt;&lt;/li&gt;&lt;/ol&gt;)</strong> and arrange the list(s) in numerical order with tabs instead. I know this isn&#8217;t the prettiest, but hey it works.<span id="more-240"></span></p>
<pre class="brush: as3">
/**
 * com.deviouswork.util.HTMLUtil
 * @version 1.0.0
 * @author Joakim Roos | j  at deviouswork dot com
 *
 * Copyright (c) 2009 Deviouswork
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the &quot;Software&quot;), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */
package com.deviouswork.util {

	/**
	 * HTMLUtil
	 */

	public class HTMLUtil {		

		public static function orderedList(source : String, tabs:int = 2) : String {
			if(source.indexOf(&quot;&lt;ol&gt;&quot;) == -1) {
				return source;
			} else {
				var tab_str : String = &quot;&quot;;
				while(tabs--) {
					tab_str += &quot;\t&quot;;
				}
				var orderedList_array : Array = source.split(&quot;&lt;/ol&gt;&lt;ol&gt;&quot;);
				var numberedList_str:String = orderedList_array[0];
				for(var i:uint = 1; i &lt; orderedList_array.length; i++) {
					var listItem_array : Array = String(orderedList_array[i]).split(&quot;&lt;li&gt;&quot;).slice(1);
					for(var j:uint = 0; j &lt; listItem_array.length; j++) {
						var list_str:String = String(j+1) + &quot;.&quot; + tab_str + HTMLUtil.replace(listItem_array[j],&quot;[\n]&quot;, &quot;&lt;br&gt;&quot;);
						list_str = HTMLUtil.remove(list_str, &quot;[\r]&quot;);
						list_str = HTMLUtil.replace(list_str, &quot;&lt;br /&gt;&quot;, &quot;&lt;br /&gt;&quot; + tab_str);
						list_str = HTMLUtil.replace(list_str, &quot;&lt;br /&gt;&quot; +tab_str + &quot;\t&quot;, &quot;&lt;br /&gt;&lt;br /&gt;&quot;);
						numberedList_str += list_str;
					}
				}
				HTMLUtil.remove(numberedList_str, &quot;&lt;/ol&gt;&quot;);
				return numberedList_str;
			}
		}

		private static function remove(source:String, remove:String):String {
			return HTMLUtil.replace(source, remove, &#039;&#039;);
		}

		private static function replace(source:String, remove:String, replace:String):String {
			var pattern:RegExp = new RegExp(remove, &#039;g&#039;);
			return source.replace(pattern, replace);
		}
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.deviouswork.com/2009/04/21/ordered-lists-in-textfieldhtmltext/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Josef Müller-Brockmann</title>
		<link>http://www.deviouswork.com/2009/02/06/josef-muller-brockmann/</link>
		<comments>http://www.deviouswork.com/2009/02/06/josef-muller-brockmann/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 13:46:18 +0000</pubDate>
		<dc:creator>Joakim Roos</dc:creator>
				<category><![CDATA[Inspiration]]></category>
		<category><![CDATA[Graphic Design]]></category>
		<category><![CDATA[Grid-System]]></category>
		<category><![CDATA[Typography]]></category>

		<guid isPermaLink="false">http://blog.deviouswork.com/?p=235</guid>
		<description><![CDATA[Sometimes you find some real gems on YouTube, like this motionpiece inspired
by Josef Müller-Brockmann. Video after the jump.
]]></description>
			<content:encoded><![CDATA[<p>Sometimes you find some real gems on YouTube, like this motionpiece inspired<br />
by <a href="http://en.wikipedia.org/wiki/Josef_M%C3%BCller-Brockmann">Josef Müller-Brockmann</a>. Video after the jump.<span id="more-235"></span><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/JWIoIOegZHE&#038;hl=sv&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/JWIoIOegZHE&#038;hl=sv&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.deviouswork.com/2009/02/06/josef-muller-brockmann/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Golden Age of Flash</title>
		<link>http://www.deviouswork.com/2009/01/24/the-golden-age-of-flash/</link>
		<comments>http://www.deviouswork.com/2009/01/24/the-golden-age-of-flash/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 15:34:23 +0000</pubDate>
		<dc:creator>Joakim Roos</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Animation]]></category>

		<guid isPermaLink="false">http://blog.deviouswork.com/?p=231</guid>
		<description><![CDATA[Video after the jump
]]></description>
			<content:encoded><![CDATA[<p>Video after the jump<span id="more-231"></span><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/zoPpg-cfIsw&#038;hl=sv&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/zoPpg-cfIsw&#038;hl=sv&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.deviouswork.com/2009/01/24/the-golden-age-of-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple ScrollBar Class</title>
		<link>http://www.deviouswork.com/2009/01/24/simple-scrollbar-class/</link>
		<comments>http://www.deviouswork.com/2009/01/24/simple-scrollbar-class/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 11:58:52 +0000</pubDate>
		<dc:creator>Joakim Roos</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Labs]]></category>
		<category><![CDATA[ScrollBar]]></category>

		<guid isPermaLink="false">http://blog.deviouswork.com/?p=229</guid>
		<description><![CDATA[Basic and simple ScrollBar class based on com.jeroenwijering.utils.Scrollbar

/**
 * com.deviouswork.display.utils.ScrollBar
 * @version 1.0.0
 * @author Joakim Roos &#124; j  at deviouswork dot com
 *
 * Bases on com.jeroenwijering.utils.Scrollbar - but allowing any displayobject
 * to be scrolled and using any graphics as a scroll.
 * (http://developer.longtailvideo.com/trac/browser/trunk/as3/com/jeroenwijering/utils/Scrollbar.as)
 *
 * Copyright (c) 2009 Deviouswork
 *
 * [...]]]></description>
			<content:encoded><![CDATA[<p>Basic and simple ScrollBar class based on <a href="http://developer.longtailvideo.com/trac/browser/trunk/as3/com/jeroenwijering/utils/Scrollbar.as">com.jeroenwijering.utils.Scrollbar</a><span id="more-229"></span>
<pre class="brush: as3">
/**
 * com.deviouswork.display.utils.ScrollBar
 * @version 1.0.0
 * @author Joakim Roos | j  at deviouswork dot com
 *
 * Bases on com.jeroenwijering.utils.Scrollbar - but allowing any displayobject
 * to be scrolled and using any graphics as a scroll.
 * (http://developer.longtailvideo.com/trac/browser/trunk/as3/com/jeroenwijering/utils/Scrollbar.as)
 *
 * Copyright (c) 2009 Deviouswork
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the &quot;Software&quot;), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */
package com.deviouswork.display.utils {

	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;		

	/**
	 * ScrollBar
	 */
	public class ScrollBar {

		private var _scroll : Sprite;
		private var _scrollBar : DisplayObject;
		private var _scrollTrack : DisplayObject;
		private var _scrollTarget : DisplayObject;
		private var _mask : DisplayObject;
		private var _proportions_num : Number;

		/*
		 * STATIC vars unused at the moment.
		 */

		public static var VERTICAL : String = &quot;vertical&quot;;
		public static var HORIZONTAL : String = &quot;horizontal&quot;;

		/**
		 * Constructor
		 *
		 * @param target	DisplayObject to scroll.
		 * @param mask		DisplayObject that masks the target.
		 * @param bar		DisplayObject used as graphic representation of the scrollbar.
		 * @param track		DisplayObject used to guide the bar.
		 */
		public function ScrollBar(target : DisplayObject, mask : DisplayObject, bar : DisplayObject, track : DisplayObject) : void {
			_scrollTarget = target;
			_mask = mask;
			_scrollBar = bar;
			_scrollTrack = track;
			MovieClip(_scrollTrack.parent).removeChild(_scrollTrack);
			MovieClip(_scrollBar.parent).removeChild(_scrollBar);
			_scroll = new Sprite();
			_scrollTrack.x = 0;
			_scrollTrack.y = 0;
			_scrollBar.x = 0;
			_scrollBar.y = 0;
			_scroll.addChild(_scrollTrack);
			_scroll.addChild(_scrollBar);
			MovieClip(_scrollTarget.parent).addChild(_scroll);
			_scroll.buttonMode = true;
		};

		/**
		 * Add events for the scroll and sets the correct proportions.
		 */
		public function draw() : void {
			_scrollTarget.y = _mask.y;
			_scroll.x = _mask.x + _mask.width + _scrollTrack.width/4;
			_scroll.y = _mask.y;
			_proportions_num = _mask.height / _scrollTarget.height;
			if(_proportions_num &lt; 1) {
				_scroll.visible = true;
				_scrollTrack.height = _mask.height;
				_scrollBar.height = _mask.height * _proportions_num;
				var hitShape : Sprite = new Sprite();
				hitShape.graphics.beginFill(0xfff000, 0);
				hitShape.graphics.drawRect(_scrollTrack.x, _scrollTrack.y, _scrollTrack.width * 2, _scrollTrack.height);
				hitShape.graphics.endFill();
				hitShape.x = -_scrollTrack.width/ 4;
				_scroll.addChild(hitShape);
				_scroll.addEventListener(MouseEvent.MOUSE_DOWN, _onMouseDown);
			} else {
				_scroll.visible = false;
				_scroll.removeEventListener(MouseEvent.MOUSE_DOWN, _onMouseDown);
			}
		};

		/**
		 * Event Handlers
		 */

		private function _onMouseDown(event_m : MouseEvent) : void {
			_scroll.addEventListener(Event.ENTER_FRAME, _onScrollTarget);
			_mask.stage.addEventListener(MouseEvent.MOUSE_UP, _onMouseUp);
		};

		private function _onMouseUp(event_m : MouseEvent) : void {
			_scroll.removeEventListener(Event.ENTER_FRAME, _onScrollTarget);
			_mask.stage.removeEventListener(MouseEvent.MOUSE_UP, _onMouseUp);
		};

		private function _onScrollTarget(event : Event) : void {
			var mps : Number = _scroll.mouseY;
			if(mps &lt; _scrollBar.height / 2) {
				_scrollBar.y = 0;
				_scrollTarget.y = _mask.y;
			} else if (mps &gt; _scroll.height - _scrollBar.height / 2) {
				_scrollBar.y = _scroll.height - _scrollBar.height;
				_scrollTarget.y = _mask.y + _mask.height - _scrollTarget.height;
			} else {
				_scrollBar.y = mps - _scrollBar.height / 2;
				_scrollTarget.y = _mask.y + _mask.height / 2 - mps / _proportions_num;
			}
		};
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.deviouswork.com/2009/01/24/simple-scrollbar-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>InteractivePNG class</title>
		<link>http://www.deviouswork.com/2009/01/21/interactivepng-class/</link>
		<comments>http://www.deviouswork.com/2009/01/21/interactivepng-class/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 15:33:15 +0000</pubDate>
		<dc:creator>Joakim Roos</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[hitTest]]></category>
		<category><![CDATA[PNG]]></category>

		<guid isPermaLink="false">http://blog.deviouswork.com/?p=227</guid>
		<description><![CDATA[MosesSupposes has written an class for dectecting hitTest on .png with transparency, meaning no more mask or hitarea&#8217;s when working with Sprites with png&#8217;s inside of them.
check the demo and download the class here:
InteractivePNG
]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.mosessupposes.com/">MosesSupposes</a> has written an class for dectecting hitTest on .png with transparency, meaning no more mask or hitarea&#8217;s when working with Sprites with png&#8217;s inside of them.</p>
<p>check the <a href="http://www.mosessupposes.com/utilities/InteractivePNG_demo.html">demo</a> and download the class here:<br />
<a href="http://blog.mosessupposes.com/?p=40">InteractivePNG</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.deviouswork.com/2009/01/21/interactivepng-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3 TextEditor</title>
		<link>http://www.deviouswork.com/2009/01/21/as3-texteditor/</link>
		<comments>http://www.deviouswork.com/2009/01/21/as3-texteditor/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 15:14:34 +0000</pubDate>
		<dc:creator>Joakim Roos</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[swc]]></category>
		<category><![CDATA[texteditor]]></category>

		<guid isPermaLink="false">http://blog.deviouswork.com/?p=225</guid>
		<description><![CDATA[AS3 TextEditor Lite is a SWC based component for rich text editor which can be used in Flash applications to be developed using Action Script 3 and Adobe Flash CS3 IDE. This component provides features like:
Dynamically attach it to any text field of your application Complete WYSIWYG Editor Formatting of characters as Bold, Italic, Underline [...]]]></description>
			<content:encoded><![CDATA[<p>AS3 TextEditor Lite is a SWC based component for rich text editor which can be used in Flash applications to be developed using Action Script 3 and Adobe Flash CS3 IDE. This component provides features like:</p>
<blockquote><p>Dynamically attach it to any text field of your application Complete WYSIWYG Editor Formatting of characters as Bold, Italic, Underline Hyperlink with color, underline options Search and replace texts Indent, Margin (left and right) Paragraph alignment left, right,center,justified Making unordered lists Line spacing, Character spacing Adding Image (No Edit) Rich Text View and HTML View (two-color coded) Clipboard features: Select All, Copy, Paste, Remove Formatting Inserting special characters.</p></blockquote>
<p>It&#8217;s only for CS3/CS4 and not for Flex. But hey, you cant have it all I guess.<br />
<a href="http://code.google.com/p/as3texteditor/">AS3 TextEditor Lite: Free rich text editor component for Adobe Flash CS3</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.deviouswork.com/2009/01/21/as3-texteditor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TextFlowLite</title>
		<link>http://www.deviouswork.com/2009/01/07/textflowlite/</link>
		<comments>http://www.deviouswork.com/2009/01/07/textflowlite/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 12:12:46 +0000</pubDate>
		<dc:creator>Joakim Roos</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Light-weight]]></category>
		<category><![CDATA[Text Layout]]></category>

		<guid isPermaLink="false">http://blog.deviouswork.com/?p=223</guid>
		<description><![CDATA[Grant Skinner has posted a nice utility class for flowing textfields, making it easy to redefine text flow size on the fly.Sure, it doesn&#8217;t have all the functionality of Adobe&#8217;s Text Layout Framework, but then again the weight when compared to TextFlowLite could be an issue when working with limited weights.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.gskinner.com/blog/archives/2009/01/multi_column_te.html">Grant Skinner</a> has posted a nice utility class for flowing textfields, making it easy to redefine text flow size on the fly.<span id="more-223"></span>Sure, it doesn&#8217;t have all the functionality of <a href="http://labs.adobe.com/technologies/textlayout/">Adobe&#8217;s Text Layout Framework</a>, but then again the weight when compared to TextFlowLite could be an issue when working with limited weights.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.deviouswork.com/2009/01/07/textflowlite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
