<?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>Webdevotion.be &#187; actionscript 3</title>
	<atom:link href="http://www.webdevotion.be/blog/tag/as3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webdevotion.be/blog</link>
	<description>Trainer for the Flash Platform and iOS</description>
	<lastBuildDate>Tue, 01 Nov 2011 10:14:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Screator: create your own wallpaper from Flash</title>
		<link>http://www.webdevotion.be/blog/2010/09/15/screator-create-your-own-wallpaper-from-flash/</link>
		<comments>http://www.webdevotion.be/blog/2010/09/15/screator-create-your-own-wallpaper-from-flash/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 15:47:03 +0000</pubDate>
		<dc:creator>Webdevotion</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[Hype]]></category>
		<category><![CDATA[lab]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[wallpaper]]></category>

		<guid isPermaLink="false">http://webdevotion.be/blog/?p=353</guid>
		<description><![CDATA[Well, just something I've been playing around with during the last couple of days: Screator. <a href="http://www.webdevotion.be/blog/2010/09/15/screator-create-your-own-wallpaper-from-flash/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Well, just something I&#8217;ve been playing around with during the last couple of days: <a href="http://www.webdevotion.be/lab/screator/">Screator</a>.  I guess an application says more than a thousand words, so just go ahead and try it.  Ideas, nags or your creations in the comments please!<br />
<span id="more-353"></span><br />
[flickr album=72157624962427464 num=5 size=Square]</p>
<p><a href="http://www.webdevotion.be/lab/screator/">Http://www.webdevotion.be/lab/screator/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdevotion.be/blog/2010/09/15/screator-create-your-own-wallpaper-from-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smoothing &lt;mx:image/&gt; &#8211; the simple way</title>
		<link>http://www.webdevotion.be/blog/2009/08/05/smoothing-mximage-the-simple-way/</link>
		<comments>http://www.webdevotion.be/blog/2009/08/05/smoothing-mximage-the-simple-way/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 14:50:20 +0000</pubDate>
		<dc:creator>Webdevotion</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[smoothing]]></category>

		<guid isPermaLink="false">http://webdevotion.be/blog/?p=263</guid>
		<description><![CDATA[Solved this little problem the simple way. One of the centralized file sharing applications we&#8217;re developing needed some form of branding at the bottom of the screens. The logo bar, 1400 px wide, needs to be resized when the user &#8230; <a href="http://www.webdevotion.be/blog/2009/08/05/smoothing-mximage-the-simple-way/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Solved this little problem the simple way.  One of the centralized file sharing applications we&#8217;re developing needed some form of branding at the bottom of the screens.  The logo bar, 1400 px wide, needs to be resized when the user changes the resolution of the browserwindow.</p>
<p>Without smoothing, things turn ugly and pixelated. With smoothing turned on, everything keeps looking the way it should, even when resized.</p>
<pre>
&lt;mx:VBox&gt;
    &lt;mx:script&gt;
	private function smoothImage ( img : Image ) : void
	{
		var bmp : Bitmap = img.content as Bitmap;
		bmp.smoothing = true;
	}
    &lt;/mx:script&gt;
    &lt;mx:image id=&quot;logoImage&quot; complete=&quot;smoothImage(logoImage)&quot; source=&quot;images/logo.png&quot; width=&quot;100%&quot; scaleContent=&quot;true&quot;/&gt;
&lt;/mx:VBox&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.webdevotion.be/blog/2009/08/05/smoothing-mximage-the-simple-way/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to merge two images into one using Actionscript</title>
		<link>http://www.webdevotion.be/blog/2009/08/05/how-to-merge-two-images-into-one-in-actionscript/</link>
		<comments>http://www.webdevotion.be/blog/2009/08/05/how-to-merge-two-images-into-one-in-actionscript/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 13:18:38 +0000</pubDate>
		<dc:creator>Webdevotion</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[bitmap]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[matrix]]></category>
		<category><![CDATA[position]]></category>
		<category><![CDATA[scale]]></category>

		<guid isPermaLink="false">http://webdevotion.be/blog/?p=254</guid>
		<description><![CDATA[Well, it&#8217;s very easy, using BitmapData and Bitmap. This example makes things a bit more complex to show some principles. Hope you learn something out of it off course. // we'll scale the first ( background ) image by 50% &#8230; <a href="http://www.webdevotion.be/blog/2009/08/05/how-to-merge-two-images-into-one-in-actionscript/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Well, it&#8217;s very easy, using BitmapData and Bitmap.  This example makes things a bit more complex to show some principles.  Hope you learn something out of it off course.<br />
<code><br />
// we'll scale the first ( background ) image by 50%<br />
var s : Number = .5;</p>
<p>// create a matrix to make the scalilng of the bitmap possible<br />
var scaleMatrix : Matrix = new Matrix();</p>
<p>// apply the scaling to the matrix<br />
scaleMatrix.scale(s,s);</p>
<p>// create a bitmapdata object from an existing bitmap ( "bmp" in this case )<br />
var scaledBitmap : BitmapData = new BitmapData(bmp.width*s,bmp.height*s,false,0);</p>
<p>// draw the content and scale it using the matrix<br />
scaledBitmap.draw(bmp,scaleMatrix);</p>
<p>// we have an embedded asset called "flickr", a flickr logo in gif format<br />
var icon : Bitmap = new flickr() as Bitmap;</p>
<p>// let's place it in the bottom right corner<br />
var ix : Number = scaledBitmap.width-icon.width;<br />
var ij : Number = scaledBitmap.height-icon.height;</p>
<p>// create a matrix for the position of the icon<br />
// note the use of the ix and ij variables in the parameters<br />
var positionMatrix : Matrix = new Matrix(1,0,0,1,ix,ij);</p>
<p>// draw the icon bmp to the bitmapdata<br />
scaledBitmap.draw( icon, positionMatrix );</p>
<p>// add the new, merged, bitmap to your displaylist<br />
var bmp : Bitmap = new Bitmap( scaledBitmap );<br />
addChild( bmp );	</p>
<p>// that's it!<br />
</code></p>
<p>PS: as per user comments I&#8217;ve also uploaded an example to use in the Flash IDE ( *.fla file ) &#8211; the above example assumes you&#8217;re using Flash Builder or another editor</p>
<p>I do have to say I don&#8217;t understand why people try to merge two bitmaps in Flash using the IDE.   You could just as easily create a MovieClip with the two bitmaps on top of each other.  Or am I missing something?  Tell me in the comments!</p>
<p>Download the example *.fla file here: <a href="http://www.webdevotion.be/blog/wp-content/mergy.fla.zip">http://www.webdevotion.be/blog/wp-content/mergy.fla.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdevotion.be/blog/2009/08/05/how-to-merge-two-images-into-one-in-actionscript/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Binding between a DateField and a Button label at runtime</title>
		<link>http://www.webdevotion.be/blog/2009/04/20/binding-between-a-datefield-and-a-button-label-at-runtime/</link>
		<comments>http://www.webdevotion.be/blog/2009/04/20/binding-between-a-datefield-and-a-button-label-at-runtime/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 06:08:13 +0000</pubDate>
		<dc:creator>Webdevotion</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[binding]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://webdevotion.be/blog/?p=249</guid>
		<description><![CDATA[When creating a runtime component to use as a popup I wanted to bind a DateField&#8217;s selectedDate property to a Button label. Because I never used bindings ( and a labelFunction ) using pure Actionscript before I had to come &#8230; <a href="http://www.webdevotion.be/blog/2009/04/20/binding-between-a-datefield-and-a-button-label-at-runtime/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When creating a runtime component to use as a popup I wanted to bind a DateField&#8217;s selectedDate property to a Button label.  Because I never used bindings ( and a labelFunction ) using pure Actionscript before I had to come up with a solution.<br />
<span id="more-249"></span><br />
This is what worked for me:</p>
<p>bt being a Button instance<br />
df being a DateField instance<br />
dateLabelFunction returns a formatted date as a string</p>
<p><code>BindingUtils.bindProperty( bt, "label", df, {name:"selectedDate",getter:function(df:DateField):String{return dateLabelFunction(df.selectedDate)}});</code></p>
<p>What we are doing here is:<br />
- Bind bt.label to df.selectedDate ( that&#8217;s the name:&#8221;selectedDate&#8221; part )<br />
- When retrieving the value of df.selectedDate use the &#8216;getter&#8217; function<br />
- The getter function returns a formatted date string</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdevotion.be/blog/2009/04/20/binding-between-a-datefield-and-a-button-label-at-runtime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Snippet day: last comma becomes &#8220;and&#8221;</title>
		<link>http://www.webdevotion.be/blog/2009/04/09/snippet-day-last-comma-becomes-and/</link>
		<comments>http://www.webdevotion.be/blog/2009/04/09/snippet-day-last-comma-becomes-and/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 08:25:40 +0000</pubDate>
		<dc:creator>Webdevotion</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://webdevotion.be/blog/?p=243</guid>
		<description><![CDATA[This little snippet will replace the last comma in a string by the word &#8221; and &#8220;. Making it more readable for the end user. In other words: the string &#8220;Other examples are rats, mice,other rodents&#8221; will be converted into &#8230; <a href="http://www.webdevotion.be/blog/2009/04/09/snippet-day-last-comma-becomes-and/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This little snippet will replace the last comma in a string by the word &#8221; and &#8220;.  Making it more readable for the end user. </p>
<p>In other words: the string &#8220;Other examples are rats, mice,other rodents&#8221; will be converted into &#8220;Other examples are rats, mice and other rodents&#8221;.<br />
<span id="more-243"></span><br />
<code><br />
var a : Array = ["rats","mice","other rodents"];<br />
var s : String = a.toString(); // returns rats,mice,other rodents<br />
var r : RegExp = /,(?![^,]+,)/g; // the magical formula<br />
s = s.replace( r ," and "); // replace the last , with and<br />
trace( s ); // rats, mice and rodents<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdevotion.be/blog/2009/04/09/snippet-day-last-comma-becomes-and/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to PUT xml to a REST interface with Basic Authentication</title>
		<link>http://www.webdevotion.be/blog/2008/12/12/how-to-put-xml-to-a-rest-interface-with-basic-authentication/</link>
		<comments>http://www.webdevotion.be/blog/2008/12/12/how-to-put-xml-to-a-rest-interface-with-basic-authentication/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 12:36:31 +0000</pubDate>
		<dc:creator>Webdevotion</dc:creator>
				<category><![CDATA[Air]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[assembla]]></category>
		<category><![CDATA[basic auth]]></category>
		<category><![CDATA[headers]]></category>
		<category><![CDATA[httprequest]]></category>
		<category><![CDATA[httpservice]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[urlloader]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://webdevotion.be/blog/?p=220</guid>
		<description><![CDATA[Well, this thing got me going for a couple of hours before things worked out. Using HTTPService did not seem to be the way to go. Long story short: URLRequest to the rescue! // basic authentication var encoder : Base64Encoder &#8230; <a href="http://www.webdevotion.be/blog/2008/12/12/how-to-put-xml-to-a-rest-interface-with-basic-authentication/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Well, this thing got me going for a couple of hours before things worked out.  Using HTTPService did not seem to be the way to go.  Long story short: URLRequest to the rescue!</p>
<p><img src="http://webdevotion.be/blog/wp-content/xml-rest-api.jpg" alt="" title="xml-rest-api"  width="600" class="alignnone size-full wp-image-225" /></p>
<p><span id="more-220"></span><br />
<code><br />
// basic authentication<br />
var encoder : Base64Encoder = new Base64Encoder();<br />
encoder.encode(username + ":" password);<br />
// send xml<br />
var header1:URLRequestHeader = new URLRequestHeader("Content-Type", "application/xml");<br />
// authenticate<br />
var header2:URLRequestHeader = new URLRequestHeader("Authorization", "Basic " + encoder.toString());<br />
// accept xml as response<br />
var header3:URLRequestHeader = new URLRequestHeader("Accept","application/xml");</p>
<p>var request:URLRequest = new URLRequest( urlToRestAPI );<br />
// mmm, maybe not necessary = allready in the headers<br />
request.contentType = "application/xml";<br />
// push the headers in the request<br />
request.requestHeaders.push(header1);<br />
request.requestHeaders.push(header2);<br />
request.requestHeaders.push(header3);</p>
<p>// put your xml in a string: &quot;&lt;ticket&gt;&lt;summary&gt;my summary&lt;/summary&gt;&lt;/ticket&gt;&quot;<br />
// generate an XML instance from the string<br />
var xml : XML = new XML( s );<br />
// put the xml in the request instance<br />
request.data = xml;<br />
// use PUT ( could depend on the API you are using, check the docs )<br />
request.method = "PUT";<br />
// use the loader to send the request<br />
var loader : URLLoader = new URLLoader( null );<br />
// wait for the complete event to do other amazing things<br />
loader.addEventListener(Event.COMPLETE,onTicketUpdated,false,0,true);<br />
// fire in the hole!<br />
loader.load( request );<br />
// take a deep breath and wait a sec<br />
// for the complete event to be triggered<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdevotion.be/blog/2008/12/12/how-to-put-xml-to-a-rest-interface-with-basic-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

