<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>

<channel>
	<title>Tiago&#039;s Weblog &#187; Flash</title>
	<atom:link href="http://blog.six4rty.ch/category/adobe/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.six4rty.ch</link>
	<description>Code &#38; Technology Aficionado - Come for the Flash, stay for more!</description>
	<lastBuildDate>Tue, 01 Nov 2011 14:06:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by/2.5/ch/</creativeCommons:license>
		<item>
		<title>another blog, more authors</title>
		<link>http://blog.six4rty.ch/2011/03/22/another-blog-more-authors/</link>
		<comments>http://blog.six4rty.ch/2011/03/22/another-blog-more-authors/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 08:08:21 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[AS3.0]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://blog.six4rty.ch/?p=1062</guid>
		<description><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2011%252F03%252F22%252Fanother-blog-more-authors%252F&title=another+blog%2C+more+authors&desc=%0D%0A%0D%0ATwo+weeks+ago+me+and+my+fellow+co-workers+have+started+our+company+blog+which+can+be+reached+at%0D%0Ahttp%3A%2F%2Fblog.publicis-modem.ch+every+open+source+initiative%2C+project+or+library+that+we+create+will+&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div>Two weeks ago me and my fellow co-workers have started our company blog which can be reached at http://blog.publicis-modem.ch every open source initiative, project or library that we create will be published there. I might do a cross link to a blog post or even write a little more about it, but I think you [...]]]></description>
			<content:encoded><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2011%252F03%252F22%252Fanother-blog-more-authors%252F&title=another+blog%2C+more+authors&desc=%0D%0A%0D%0ATwo+weeks+ago+me+and+my+fellow+co-workers+have+started+our+company+blog+which+can+be+reached+at%0D%0Ahttp%3A%2F%2Fblog.publicis-modem.ch+every+open+source+initiative%2C+project+or+library+that+we+create+will+&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p><a href="http://blog.publicis-modem.ch"><img class="alignnone size-full wp-image-1065" title="blogModem" src="http://blog.six4rty.ch/wp-content/uploads/2011/03/blogModem.jpg" alt="" width="620" height="252" /></a></p>
<p>Two weeks ago me and my fellow co-workers have started our company blog which can be reached at<br />
<a href="http://blog.publicis-modem.ch" target="_blank">http://blog.publicis-modem.ch</a> every open source initiative, project or library that we create will be published there.<br />
I might do a cross link to a blog post or even write a little more about it, but I think you should keep an eye over there aswell, we already released two opensource projects (<a href="http://opensource.publicis-modem.ch/websvn/listing.php?repname=Open+Source+at+Publicis+Modem+Repository&amp;path=%2Fwallago%2Ftrunk%2Fsrc%2F&amp;#a820ba52e91ea86abf879a04967ee2ccc" target="_blank">wallaGo </a>and <a href="http://opensource.publicis-modem.ch/websvn/listing.php?repname=Open+Source+at+Publicis+Modem+Repository&amp;path=%2Fas3square%2Ftrunk%2Fsrc%2F&amp;#a8ac9b707f5b226f9b5e414505c42f451" target="_blank">AS3Square</a>) and there is more to come soon, so stay tuned for some fresh content and don&#8217;t forget to bookmark a new fresh blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.six4rty.ch/2011/03/22/another-blog-more-authors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/2.5/ch/</creativeCommons:license>
	</item>
		<item>
		<title>AS3: OSMF LightweightElement</title>
		<link>http://blog.six4rty.ch/2010/10/02/as3-osmf-lightweightelement/</link>
		<comments>http://blog.six4rty.ch/2010/10/02/as3-osmf-lightweightelement/#comments</comments>
		<pubDate>Sat, 02 Oct 2010 12:32:41 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[OSMF]]></category>
		<category><![CDATA[Quick Hints]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://blog.six4rty.ch/?p=861</guid>
		<description><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F10%252F02%252Fas3-osmf-lightweightelement%252F&title=AS3%3A+OSMF+LightweightElement&desc=You+are+in+need+of+a+simple+video+player%2C+iightweight+and+easy+to+use%3F%0D%0AYou+think+OSMF+is+too+complicated%2C+let+me+correct+you+and+present+you+the+LightVideoElement+Class.%0D%0A%0D%0ASimple+to+use%2C+quickly+up+&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div>You are in need of a simple video player, iightweight and easy to use? You think OSMF is too complicated, let me correct you and present you the LightVideoElement Class. Simple to use, quickly up and running and all needed &#8220;basic&#8221; features available. It&#8217;s even a default in OSMF, I actually wonder why no one [...]]]></description>
			<content:encoded><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F10%252F02%252Fas3-osmf-lightweightelement%252F&title=AS3%3A+OSMF+LightweightElement&desc=You+are+in+need+of+a+simple+video+player%2C+iightweight+and+easy+to+use%3F%0D%0AYou+think+OSMF+is+too+complicated%2C+let+me+correct+you+and+present+you+the+LightVideoElement+Class.%0D%0A%0D%0ASimple+to+use%2C+quickly+up+&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p><a href="http://blog.six4rty.ch/wp-content/uploads/2010/08/osmfcode.jpg"><img class="alignleft size-medium wp-image-807" style="margin: 10px;" title="osmfcode" src="http://blog.six4rty.ch/wp-content/uploads/2010/08/osmfcode-300x270.jpg" alt="" width="210" height="189" /></a>You are in need of a simple video player, iightweight and easy to use?<br />
You think OSMF is too complicated, let me correct you and present you the LightVideoElement Class.</p>
<p>Simple to use, quickly up and running and all needed &#8220;basic&#8221; features available.<br />
It&#8217;s even a default in OSMF, I actually wonder why no one has written about it yet, it&#8217;s really easy to use and you can do all the basic things with it that a videoplayer needs to support nowadays and on top of it, it&#8217;s only 10k when compiled.</p>
<p>I&#8217;ve been using it for the last 2 projects I&#8217;ve made, and I couldn&#8217;t be happier, let&#8217;s have a quick look on how to use it:<span id="more-861"></span></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">_mediaPlayerSprite		= <span style="color: #000000; font-weight: bold;">new</span> MediaPlayerSprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
_mediaPlayerSprite.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0x000000, <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span>;
_mediaPlayerSprite.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">640</span>,<span style="color: #cc66cc;">360</span><span style="color: #66cc66;">&#41;</span>;
_mediaPlayerSprite.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
_videoElement			= <span style="color: #000000; font-weight: bold;">new</span> LightweightVideoElement<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
_videoElement.<span style="color: #006600;">resource</span>		= <span style="color: #000000; font-weight: bold;">new</span> URLResource<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;pathtoyourvideo.flv&quot;</span> <span style="color: #66cc66;">&#41;</span>;
_videoElement.<span style="color: #0066CC;">smoothing</span>		= <span style="color: #000000; font-weight: bold;">true</span>;
&nbsp;
addChild<span style="color: #66cc66;">&#40;</span> _mediaPlayerSprite <span style="color: #66cc66;">&#41;</span>;
_mediaPlayerSprite.<span style="color: #006600;">media</span>		= _videoElement;</pre></div></div>

<p>That&#8217;s it, no I&#8217;m not joking this is really it, you don&#8217;t need anything else to simply play a video,  now you might be asking yourself, well that&#8217;s cool but how can I control the playback? It&#8217; easy and very intuitive, basically you only need to access the mediaplayer instance which is integrated into the _mediaPlayerSprite, there all public methods like play, pause, stop, events and so on are available for you to use. take a look at some of the functions i implemented  to be able to control videoplayback.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	_mediaPlayerSprite.<span style="color: #006600;">mediaPlayer</span>.<span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">pause</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	_mediaPlayerSprite.<span style="color: #006600;">mediaPlayer</span>.<span style="color: #0066CC;">pause</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">stop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	_mediaPlayerSprite.<span style="color: #006600;">mediaPlayer</span>.<span style="color: #0066CC;">stop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> currentTime<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">int</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">return</span> _mediaPlayerSprite.<span style="color: #006600;">mediaPlayer</span>.<span style="color: #006600;">currentTime</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> videoDuration<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">int</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">return</span> _mediaPlayerSprite.<span style="color: #006600;">mediaPlayer</span>.<span style="color: #0066CC;">duration</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>See, simple, easy and lighting fast.<br />
But keep in mind that the LightWeightVideoElement has limited support, you can play every kind of flash supported videos, you can do everything a basic player needs to do, but as soon you start using SerialElements, Parallel elements and so on, then you should switch back to the default setup.<br />
As usual you can get all the information and documentation from the official <a href="http://www.opensourcemediaframework.com">OSMF</a> site.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.six4rty.ch/2010/10/02/as3-osmf-lightweightelement/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/2.5/ch/</creativeCommons:license>
	</item>
		<item>
		<title>AS3: Embed specific characters (part.2)</title>
		<link>http://blog.six4rty.ch/2010/08/23/as3-embed-specific-characters-part-2/</link>
		<comments>http://blog.six4rty.ch/2010/08/23/as3-embed-specific-characters-part-2/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 21:44:38 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Quick Hints]]></category>
		<category><![CDATA[Utils]]></category>
		<category><![CDATA[AS3.0]]></category>
		<category><![CDATA[Font]]></category>

		<guid isPermaLink="false">http://blog.six4rty.ch/?p=840</guid>
		<description><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F08%252F23%252Fas3-embed-specific-characters-part-2%252F&title=AS3%3A+Embed+specific+characters+%28part.2%29&desc=Just+as+a+quick+update%2C+I%27ve+updated+the+previously+created+unicode+finder+app%2C+to+be+a+bit+more+helpful+for+the+everyday+usage.%0D%0AHere+a+list+of+things+that+have+been+changed%3A%0D%0A%0D%0A%09No+double+unicodes.%0D&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div>Just as a quick update, I&#8217;ve updated the previously created unicode finder app, to be a bit more helpful for the everyday usage. Here a list of things that have been changed: No double unicodes. Automatic generation of embed code, easy for you to copy &#38; paste directly into your application. One thing that I [...]]]></description>
			<content:encoded><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F08%252F23%252Fas3-embed-specific-characters-part-2%252F&title=AS3%3A+Embed+specific+characters+%28part.2%29&desc=Just+as+a+quick+update%2C+I%27ve+updated+the+previously+created+unicode+finder+app%2C+to+be+a+bit+more+helpful+for+the+everyday+usage.%0D%0AHere+a+list+of+things+that+have+been+changed%3A%0D%0A%0D%0A%09No+double+unicodes.%0D&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p>Just as a quick update, I&#8217;ve updated the previously created unicode finder app, to be a bit more helpful for the everyday usage.<br />
Here a list of things that have been changed:</p>
<ul>
<li>No double unicodes.</li>
<li>Automatic generation of embed code, easy for you to copy &amp; paste directly into your application.</li>
</ul>
<p>One thing that I can&#8217;t handle for you is to define the source of the font with it&#8217;s according fontname as defined in your system, but hey if I find a way around this, I will update it.</p>
<p>And again if you would like to play around with it, here the app. Have fun!</p>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_0" width="616" height="494">
      <param name="movie" value="http://blog.six4rty.ch/wp-content/uploads/2010/08/UnicodeFinder1.swf" />
      <param name="allowfullscreen" value="true" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://blog.six4rty.ch/wp-content/uploads/2010/08/UnicodeFinder1.swf" width="616" height="494" allowfullscreen="true">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>

]]></content:encoded>
			<wfw:commentRss>http://blog.six4rty.ch/2010/08/23/as3-embed-specific-characters-part-2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/2.5/ch/</creativeCommons:license>
	</item>
		<item>
		<title>AS3: Embed specific characters</title>
		<link>http://blog.six4rty.ch/2010/08/21/as3-embed-specific-characters/</link>
		<comments>http://blog.six4rty.ch/2010/08/21/as3-embed-specific-characters/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 17:40:31 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Quick Hints]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Utils]]></category>
		<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Font]]></category>

		<guid isPermaLink="false">http://blog.six4rty.ch/?p=820</guid>
		<description><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F08%252F21%252Fas3-embed-specific-characters%252F&title=AS3%3A+Embed+specific+characters&desc=%0D%0A%0D%0AYou+might+have+read+on+one+of+my+previous+tweets%2C+where+I+was+screaming+about+using+%22special%22+characters+in+Flash%2C+with+%22special%22+I+mean+arabic%2C+cyrillic%2C+hebrew%2C+chinese+simplified+and+traditiona&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div>You might have read on one of my previous tweets, where I was screaming about using &#8220;special&#8221; characters in Flash, with &#8220;special&#8221; I mean arabic, cyrillic, hebrew, chinese simplified and traditional, as well japanese. I know,  I know, there is TLF (Text Layout Framework) that handles the whole text, but I&#8217;m talking about embedding the [...]]]></description>
			<content:encoded><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F08%252F21%252Fas3-embed-specific-characters%252F&title=AS3%3A+Embed+specific+characters&desc=%0D%0A%0D%0AYou+might+have+read+on+one+of+my+previous+tweets%2C+where+I+was+screaming+about+using+%22special%22+characters+in+Flash%2C+with+%22special%22+I+mean+arabic%2C+cyrillic%2C+hebrew%2C+chinese+simplified+and+traditiona&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p><img class="alignleft size-medium wp-image-724" style="margin: 10px;" title="as3code" src="http://blog.six4rty.ch/wp-content/uploads/2010/07/as3code-300x270.jpg" alt="" width="210" height="189" /></p>
<p>You might have read on one of my previous tweets, where I was screaming about using &#8220;special&#8221; characters in Flash, with &#8220;special&#8221; I mean arabic, cyrillic, hebrew, chinese simplified and traditional, as well japanese.</p>
<p>I know,  I know, there is TLF (Text Layout Framework) that handles the whole text, but I&#8217;m talking about embedding the font, did you knew that the complete chinese Unicode range helds something around 20&#8217;000 characters? You might think so what? Let me tell you that the complete chinese character range is over 7MB big!!! Do you really want to let your viewers download a 7MB file just for the font? No.</p>
<p>So I&#8217;ve created a quick app that will enable you to read out the UTF code from the text you need to use, with it you can specifically embed only the characters you need and take the file size down to a minimum. Now there is only a downside of this method, if the textual content changes a day, you need to again import the new characters.<br />
Apart from that, I haven&#8217;t seen any bad things about this implementation.</p>
<p>At the end of this post you will find an useful small tool to get all the needed characters.<span id="more-820"></span></p>
<p>As an example below with this line you are embedding a font only containing numerals typing 1234567890 will give you a range from U+0030 to U+0039</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">Embed(source=&quot;font_file_name&quot;, fontName=&quot;font_name&quot;, mimeType=&quot;application/x-font-truetype&quot;, unicodeRange=&quot;U+0030-U+0039,U+002E&quot;)]</pre></div></div>

<p>So let&#8217;s assume you would like to write this: <em>&#8220;Nemusíte oči vidět, musíte vidění&#8221;</em> which means <em>&#8220;You don&#8217;t need eyes to see, you need vision&#8221;</em> and only embed the needed characters, you would embed your font like this</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">Embed(source=&quot;font_file_name&quot;, fontName=&quot;font_name&quot;,  mimeType=&quot;application/x-font-truetype&quot;,  unicodeRange=&quot;U+004e, U+0065, U+006d, U+0075, U+0073, U+00ed, U+0074, U+0065, U+0020,  U+006f, U+010d, U+0069, U+0020, U+0076, U+0069, U+0064, U+011b, U+0074,  U+002c, U+0020, U+006d, U+0075, U+0073, U+00ed, U+0074, U+0065, U+0020,  U+0076, U+0069, U+0064, U+011b, U+006e, U+00ed&quot;)]</pre></div></div>

<p>If you don&#8217;t know how to use this kind of font embedding, have a read here:<a href="http://soledadpenades.com/2008/10/21/embedding-fonts-in-actionscript-3-using-flex-sdk/" target="_blank"></p>
<p>http://soledadpenades.com/2008/10/21/embedding-fonts-in-actionscript-3-using-flex-sdk/</a></p>
<p>Test ride it your self and have fun <img src='http://blog.six4rty.ch/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_1" width="616" height="494">
      <param name="movie" value="http://blog.six4rty.ch/wp-content/uploads/2010/08/UnicodeFinder1.swf" />
      <param name="allowfullscreen" value="true" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://blog.six4rty.ch/wp-content/uploads/2010/08/UnicodeFinder1.swf" width="616" height="494" allowfullscreen="true">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>

]]></content:encoded>
			<wfw:commentRss>http://blog.six4rty.ch/2010/08/21/as3-embed-specific-characters/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/2.5/ch/</creativeCommons:license>
	</item>
		<item>
		<title>Foundation Flash CS5</title>
		<link>http://blog.six4rty.ch/2010/08/08/foundation-flash-cs5/</link>
		<comments>http://blog.six4rty.ch/2010/08/08/foundation-flash-cs5/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 17:32:04 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[CS5]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.six4rty.ch/?p=817</guid>
		<description><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F08%252F08%252Ffoundation-flash-cs5%252F&title=Foundation+Flash+CS5&desc=After+4+years+Tom+Green+and+I+just+published+our+latest+book%2C+this+time+we+are+not+talking+about+Flash+%26amp%3B+After+Effects%2C+rather+the+newest+and+coolest+version+since+the+history+of+Flash%2C+Adobe%27s+Fl&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div>After 4 years Tom Green and I just published our latest book, this time we are not talking about Flash &#38; After Effects, rather the newest and coolest version since the history of Flash, Adobe&#8217;s Flash CS5. If you are just learning the ins and outs of flash, then this is a book you shouldn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F08%252F08%252Ffoundation-flash-cs5%252F&title=Foundation+Flash+CS5&desc=After+4+years+Tom+Green+and+I+just+published+our+latest+book%2C+this+time+we+are+not+talking+about+Flash+%26amp%3B+After+Effects%2C+rather+the+newest+and+coolest+version+since+the+history+of+Flash%2C+Adobe%27s+Fl&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p><a href="http://blog.six4rty.ch/wp-content/uploads/2010/08/9781430229940.jpg"><img class="alignleft size-full wp-image-818" title="9781430229940" src="http://blog.six4rty.ch/wp-content/uploads/2010/08/9781430229940.jpg" alt="" width="200" height="247" /></a>After 4 years Tom Green and I just published our latest book, this time we are not talking about Flash &amp; After Effects, rather the newest and coolest version since the history of Flash, Adobe&#8217;s Flash CS5. If you are just learning the ins and outs of flash, then this is a book you shouldn&#8217;t miss, lots of examples, code snippets, cool projects and even an Android game is being built.</p>
<p>Flash is one of the most engaging, innovative, and versatile  technologies available—allowing the creation of anything from animated  banners and simple cartoons, to Rich Internet Applications, interactive  videos, and dynamic user interfaces for web sites, kiosks, devices, or  DVDs. The possibilities are endless, and now it just got better.</p>
<p>Flash CS5 boasts a host of new features, including the  much-anticipated iPhone application creation feature, a whole new  animation engine enabling full manipulation of tweens and paths, custom  easing, improved inverse kinematics, a revamped timeline, built-in 3D,  and much more.</p>
<p><span id="more-817"></span></p>
<p>This book is all you&#8217;ll need to learn Flash CS5 from the ground up.  If you already have Flash experience, this book will allow you to  quickly catch up on all the cool new features. Flash experts Tom Green  and Tiago Dias guide you step-by-step through all facets of Flash CS5,  keeping the emphasis firmly on good design techniques that you use in  your own projects.</p>
<ul>
<li>Learn Flash design from the ground up, or just get to grips with the new features, with a series of step-by-step tutorials.</li>
<li>Provides an easy introduction to ActionScript 3.0 coding, but the focus is mainly kept on design.</li>
<li>Learn from the experts—written by renowned Flash designers Tom Green and Tiago Dias.</li>
</ul>
<h3>What You&#8217;ll Learn</h3>
<ul>
<li>How to create an iPhone application.</li>
<li>The ins and outs of the Flash CS5 interface</li>
<li>How to use all of Flash CS5&#8242;s essential features, such as text, graphics, and animation</li>
<li>How to use video and sound effectively in Flash</li>
<li>The fundamentals of Flash CS5’s new animation and timeline features</li>
<li>The basics of ActionScript 3.0</li>
<li>How to populate a Flash movie with dynamic data such as XML.</li>
</ul>
<h3>Who this book is for</h3>
<p>This book is for both beginners who want a solid grounding in Flash  CS5, and designers with previous Flash experience, who want to get up to  speed with the new features.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.six4rty.ch/2010/08/08/foundation-flash-cs5/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/2.5/ch/</creativeCommons:license>
	</item>
		<item>
		<title>AS3: Multiline textfields and Line Metrics</title>
		<link>http://blog.six4rty.ch/2010/07/31/as3-multiline-textfields-and-line-metrics/</link>
		<comments>http://blog.six4rty.ch/2010/07/31/as3-multiline-textfields-and-line-metrics/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 11:25:25 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Quick Hints]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[AS3.0]]></category>
		<category><![CDATA[StringUtil]]></category>
		<category><![CDATA[TextField]]></category>

		<guid isPermaLink="false">http://blog.six4rty.ch/?p=791</guid>
		<description><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F07%252F31%252Fas3-multiline-textfields-and-line-metrics%252F&title=AS3%3A+Multiline+textfields+and+Line+Metrics&desc=Last+week+I+had+to+do+something+that+I+never+thought+of%2C+let+me+present+you+the+case%3A%0D%0A%0D%0AFirst+of+all+we+have+a+multiline%2C+word-wrapped+textfield+in+AS3%2C+the+text+is+picked+up+from+an+external+XML+fil&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div>Last week I had to do something that I never thought of, let me present you the case: First of all we have a multiline, word-wrapped textfield in AS3, the text is picked up from an external XML file and gets styled with a CSS stylesheet, the textfield CAN have one line or multiple lines [...]]]></description>
			<content:encoded><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F07%252F31%252Fas3-multiline-textfields-and-line-metrics%252F&title=AS3%3A+Multiline+textfields+and+Line+Metrics&desc=Last+week+I+had+to+do+something+that+I+never+thought+of%2C+let+me+present+you+the+case%3A%0D%0A%0D%0AFirst+of+all+we+have+a+multiline%2C+word-wrapped+textfield+in+AS3%2C+the+text+is+picked+up+from+an+external+XML+fil&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p><a href="http://blog.six4rty.ch/wp-content/uploads/2010/07/as3code.jpg"><img class="alignleft size-medium wp-image-724" style="margin: 10px;" title="as3code" src="http://blog.six4rty.ch/wp-content/uploads/2010/07/as3code-300x270.jpg" alt="" width="210" height="189" /></a>Last week I had to do something that I never thought of, let me present you the case:</p>
<p>First of all we have a multiline, word-wrapped textfield in AS3, the text is picked up from an external XML file and gets styled with a CSS stylesheet, the textfield CAN have one line or multiple lines (depending on the translation and the language used), if the text is only an one-liner, the graphic (a simple small gray arrow) needs to be placed after the text in the middle of the first line, so you are able to visualize this, think about a standard &lt;li&gt; tag where you get the black dot, in my case just at the other side eg. at the end fo the line. have a look at the <a rel="lightbox" href="http://blog.six4rty.ch/wp-content/uploads/2010/07/lastLine.jpg">Example</a> for a visual clarification what I want to achieve.</p>
<p>Basically a simple task, you grab the textlength add the gutter and margin to it and place the small arrow at that position.. but what do you do when the text goes multine and word wraps automatically?<br />
After doing some experiments, I&#8217;ve came up with a simple yet appropriate solution for this.<br />
<span id="more-791"></span>Let&#8217;s start with a simple text field, containing some text and setup for multiline and wordwrapping.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> tf:<span style="color: #0066CC;">TextField</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
tf.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;Lorem Ipsum is simply dummy text of the printing and typesetting industry.&quot;</span>;
tf.<span style="color: #0066CC;">width</span> = <span style="color: #cc66cc;">100</span>;
tf.<span style="color: #0066CC;">multiline</span> = <span style="color: #000000; font-weight: bold;">true</span>;
tf.<span style="color: #0066CC;">wordWrap</span> = <span style="color: #000000; font-weight: bold;">true</span>;
addChild<span style="color: #66cc66;">&#40;</span> tf <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>This will display a simple textfield without any formatting with 5 lines of content. Why did I set a width value on my textfield? Well without it, the textfield would just be as wide as the text, resulting in a single line text, and that&#8217;s not what we want.</p>
<p>Now we create a simple square / dot / arrow whatever you like acting as a marker for the end of line, so you can visualize what&#8217;s happening, I&#8217;ve created a small rectangle like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> rect:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
rect.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xff0000<span style="color: #66cc66;">&#41;</span>;
rect.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;
rect.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span> rect <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Simple rectangle, doesn&#8217;t need much of an explanation, maybe you asking yourself why I&#8217;ve set it at x &amp; y 0? Although I could position the rectangle right at the proper position I always preferred to use the setters of it so I rather create all my shapes/graphs at 0,0 and move them with myShape.x = 100, it makes things more obvious to read and you find it much quicker then doing directly on the drawRect() method.</p>
<p>Next up let&#8217;s have a look at our class that returns the requested values.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> StringUtil
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> _lastChar		:TextLineMetrics;
	<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">_x</span>			:<span style="color: #0066CC;">int</span>;
	<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">_y</span>			:<span style="color: #0066CC;">int</span>;
&nbsp;
	<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> _gutter		:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">2</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> getEndOfLine<span style="color: #66cc66;">&#40;</span> tf:<span style="color: #0066CC;">TextField</span>, line:<span style="color: #0066CC;">int</span> <span style="color: #66cc66;">&#41;</span>:Point
	<span style="color: #66cc66;">&#123;</span>
		_lastChar 	= tf.<span style="color: #006600;">getLineMetrics</span><span style="color: #66cc66;">&#40;</span>line<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #0066CC;">_x</span>		= tf.<span style="color: #006600;">x</span> + _lastChar.<span style="color: #0066CC;">width</span> + _gutter;
		<span style="color: #0066CC;">_y</span>		= _lastChar.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">*</span> line  + _lastChar.<span style="color: #006600;">ascent</span>;
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">_x</span>, <span style="color: #0066CC;">_y</span> <span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>What we are doing here is rather simple then you think. First we pass the textfield and the desired line to our static function, then using the getLineMetrics() method we return the desired line&#8217;s metrics, this can now be used to set an x and y position of the to be returned Point(). as you see at the _x value, I&#8217;m just telling it to add the textfields x position to the width of the requested line, at the end we add the gutter value for the textfield.<br />
The vertical position is another story, here we need to get the height of the desired line and multiply with it. this has the reason that there is no method available to get the proper y position of the line, so by multiplying the textheight with the desired line you get the proper y position of it. After that calculation we add the _lastCahr.ascent property of the line, asking what ascent? Take a look at the image below for more information about it but basically it&#8217;s just the length of the baseline to the top of the line height in pixels, so exactly the middle of our text.</p>
<p>Have a look at the image below for a nice and clean overview about the gutter of a flash textfield as well about the other properties a textfield has.</p>
<p><a href="http://blog.six4rty.ch/wp-content/uploads/2010/07/text-metrics.jpg" rel="lightbox"><img class="size-medium wp-image-800 alignnone" title="text-metrics" src="http://blog.six4rty.ch/wp-content/uploads/2010/07/text-metrics-300x200.jpg" alt="" width="180" height="120" /></a></p>
<p>Something you should also be aware of is that the width of the text line is relative to the textfield width, but you need to subtract the gutter width of 4 pixels (2 pixels on each side ).</p>
<p>Now that our class is available let&#8217;s take a look at how I used it for this example.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> point:Point = StringUtil.<span style="color: #006600;">getEndOfLine</span><span style="color: #66cc66;">&#40;</span> tf, tf.<span style="color: #006600;">numLines</span> - <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span>;
rect.<span style="color: #006600;">x</span> = point.<span style="color: #006600;">x</span>;
rect.<span style="color: #006600;">y</span> = point.<span style="color: #006600;">y</span>;</pre></div></div>

<p>What we are doing here is nothing else then creating a new Point based on the position returned by our class, passing the textfield and specially since I want to have the rectangle on the LAST line I just ask for the textfields number of lines &#8211; 1.</p>
<p><a href="http://blog.six4rty.ch/wp-content/uploads/2010/07/lastLine.jpg"><img class="size-full wp-image-794 alignnone" title="lastLine" src="http://blog.six4rty.ch/wp-content/uploads/2010/07/lastLine.jpg" alt="" width="199" height="113" /></a><br />
When running this example above you should see the small red rectangle on the last line of our textfield. yay!!!</p>
<p>You can download the StringUtil class here: <a href="http://blog.six4rty.ch/wp-content/uploads/2010/07/StringUtil.as_.zip">StringUtil.as</a><br />
Hope this serves you as well as it served me last week, and don&#8217;t forget to leave a comment if you have any questions about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.six4rty.ch/2010/07/31/as3-multiline-textfields-and-line-metrics/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/2.5/ch/</creativeCommons:license>
	</item>
		<item>
		<title>AS3: Quickhint: Shared Objects</title>
		<link>http://blog.six4rty.ch/2010/07/24/as3-quick-hint-shared-objects/</link>
		<comments>http://blog.six4rty.ch/2010/07/24/as3-quick-hint-shared-objects/#comments</comments>
		<pubDate>Sat, 24 Jul 2010 16:51:54 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Media Server]]></category>
		<category><![CDATA[Quick Hints]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Shared Object]]></category>

		<guid isPermaLink="false">http://blog.six4rty.ch/?p=542</guid>
		<description><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F07%252F24%252Fas3-quick-hint-shared-objects%252F&title=AS3%3A+Quickhint%3A+Shared+Objects&desc=%0D%0A%0D%0ALast+week+while+working+on+the+interface+for+my+new+upcoming+library+I+needed+a+way+to+save+some+data+on+the+users+computer%2C+altough+I%27m+working+with+AIR+I+could+easily+save+an+xml+or+a+txt+file+t&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div>Last week while working on the interface for my new upcoming library I needed a way to save some data on the users computer, altough I&#8217;m working with AIR I could easily save an xml or a txt file to the users local computer, but as soon as I would start writing a pure as3 [...]]]></description>
			<content:encoded><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F07%252F24%252Fas3-quick-hint-shared-objects%252F&title=AS3%3A+Quickhint%3A+Shared+Objects&desc=%0D%0A%0D%0ALast+week+while+working+on+the+interface+for+my+new+upcoming+library+I+needed+a+way+to+save+some+data+on+the+users+computer%2C+altough+I%27m+working+with+AIR+I+could+easily+save+an+xml+or+a+txt+file+t&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p><a href="http://blog.six4rty.ch/wp-content/uploads/2010/07/as3code.jpg"><img class="alignleft size-medium wp-image-724" style="margin: 10px;" title="as3code" src="http://blog.six4rty.ch/wp-content/uploads/2010/07/as3code-300x270.jpg" alt="" width="210" height="189" /></a></p>
<p>Last week while working on the interface for my new upcoming library I needed a way to save some data on the users computer, altough I&#8217;m working with AIR I could easily save an xml or a txt file to the users local computer, but as soon as I would start writing a pure as3 project I would have to rewrite it again, as I can&#8217;t be sure that the client will have Flash Player 10 or even the rights to save to it&#8217;s local harddisk, some people working at bigger companies are not allowed to save anything to their local harddisk due to security rights.</p>
<p>The solution for this is simple yet effective, you need to use SharedObjects aka. Cookies in Flash.</p>
<p>Shared Objects can do the following:</p>
<ul>
<li><strong>Maintain Local Persistence</strong>: Saves data locally on the users drive, for example you could save the last application state or the score of the last game, create a local highscore list and many many more applications for local use.</li>
<li><strong>Store and Share Data on FMS</strong>: Basically the same as before, but with the difference that you saving the shared object on a flash media server. Good thing about it, it can be shared throughout multiple computers, the same user using the same application on multiple computers can save its data on a server.</li>
<li><strong>Share data in realtime</strong>: using FMS you can aswell for example save the state of a multiuser application saving the current state of the applcation, every new user will get the current state based on the shared object</li>
</ul>
<p>More information about Shared Objects can be found <a href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/net/SharedObject.html" target="_blank">HERE </a></p>
<p><span id="more-542"></span></p>
<p>Let me show you a few lines of code and explain what you can do with it.</p>
<p>The most basic example is how to write data into a shared object.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> _so:<span style="color: #0066CC;">SharedObject</span>;
_so = <span style="color: #0066CC;">SharedObject</span>.<span style="color: #0066CC;">getLocal</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;myLocalData&quot;</span><span style="color: #66cc66;">&#41;</span>;
_so.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">firstname</span> = <span style="color: #ff0000;">&quot;myfirstname&quot;</span>;
_so.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">lastname</span> = <span style="color: #ff0000;">&quot;mylastname&quot;</span>;
_so.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">age</span> = <span style="color: #ff0000;">&quot;30&quot;</span>;
_so.<span style="color: #0066CC;">flush</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>In the example above we create a new variable called _so of the type SharedObject, after that we use the getLocal() method to create the shared object, if no shared object does not already exist it will be created. if the call fails or the parameters passed along are invalid, flash throws an exception. Calling the flush() method the data will be saved to the users local harddisk.</p>
<p>Next up lets see how you can read from a persistent shared object.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> _so:<span style="color: #0066CC;">SharedObject</span>;
_so = <span style="color: #0066CC;">SharedObject</span>.<span style="color: #0066CC;">getLocal</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;myLocalData&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> _so.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">firstname</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//traces myfirstname</span>
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>_so.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">lastname</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// traces mylastname</span>
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>_so.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">age</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// traces 30</span></pre></div></div>

<p>This time we do basically the same as before, but instead of saving data we call data, when calling _so.data.age you are going to grab the sharedobjects property named age which results in 30.</p>
<p>If you rather prefer to save SharedObjects to an FMS, you can use it this way:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> _nc:<span style="color: #0066CC;">NetConnection</span>;
<span style="color: #000000; font-weight: bold;">var</span> _so:<span style="color: #0066CC;">SharedObject</span>;
&nbsp;
_nc = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">NetConnection</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
_nc.<span style="color: #0066CC;">connect</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;rtmp://yourFMSserver/yourAppName&quot;</span><span style="color: #66cc66;">&#41;</span>;
_so = <span style="color: #0066CC;">SharedObject</span>.<span style="color: #006600;">getRemote</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;myRemoteData&quot;</span>, nc.<span style="color: #006600;">uri</span>, <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;
_so.<span style="color: #0066CC;">connect</span><span style="color: #66cc66;">&#40;</span> nc <span style="color: #66cc66;">&#41;</span>;
_so.<span style="color: #0066CC;">setProperty</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;names&quot;</span>, <span style="color: #66cc66;">&#123;</span>firstame:myfirstname, lastname:myLastname<span style="color: #66cc66;">&#125;</span> <span style="color: #66cc66;">&#41;</span>;
_so.<span style="color: #0066CC;">setProperty</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;age&quot;</span>, <span style="color: #66cc66;">&#123;</span><span style="color: #ff0000;">&quot;30&quot;</span><span style="color: #66cc66;">&#125;</span> <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>This time we create a new NetConnection to the Flash Media Server and it&#8217;s application, calling the getRemote() method acts the same as using the getLocal() method, but you also need to pass the netconnections URI to be able to save the the sharedobject remotely.<br />
Differently from the local version we use the setProperty() method to save data on the remote Shared Object.</p>
<p>These are the basics for handling Shared Objects, if you have any further questions just drop me a line and I might be able to help you out.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.six4rty.ch/2010/07/24/as3-quick-hint-shared-objects/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/2.5/ch/</creativeCommons:license>
	</item>
		<item>
		<title>AS3 &amp; Facebook: Uploading Webcam Photos</title>
		<link>http://blog.six4rty.ch/2010/07/17/as3-facebook-uploading-webcam-photos/</link>
		<comments>http://blog.six4rty.ch/2010/07/17/as3-facebook-uploading-webcam-photos/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 12:34:27 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[AS3.0]]></category>
		<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://blog.six4rty.ch/?p=740</guid>
		<description><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F07%252F17%252Fas3-facebook-uploading-webcam-photos%252F&title=AS3+%26+Facebook%3A+Uploading+Webcam+Photos&desc=Facebook..+Could+you+live+without+facebook+nowadays%3F+Sometimes+I%27m+happy+when+I+don%27t+get+anything+on+facebook%2C+just+to+have+a+bit+of+peace+and+quiet+of+it.%0D%0A%0D%0AWell%2C+nevertheless%2C+I%27m+writing+this+art&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div>Facebook.. Could you live without facebook nowadays? Sometimes I&#8217;m happy when I don&#8217;t get anything on facebook, just to have a bit of peace and quiet of it. Well, nevertheless, I&#8217;m writing this article because I&#8217;ve seen this post on the Adobe Forums by dmennenoh where he asked for the possibilities of using the Facebook [...]]]></description>
			<content:encoded><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F07%252F17%252Fas3-facebook-uploading-webcam-photos%252F&title=AS3+%26+Facebook%3A+Uploading+Webcam+Photos&desc=Facebook..+Could+you+live+without+facebook+nowadays%3F+Sometimes+I%27m+happy+when+I+don%27t+get+anything+on+facebook%2C+just+to+have+a+bit+of+peace+and+quiet+of+it.%0D%0A%0D%0AWell%2C+nevertheless%2C+I%27m+writing+this+art&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p><a href="http://blog.six4rty.ch/wp-content/uploads/2010/07/as3FB.jpg"><img class="size-medium wp-image-741 alignleft" style="margin: 10px;" title="as3FB" src="http://blog.six4rty.ch/wp-content/uploads/2010/07/as3FB-300x270.jpg" alt="" width="210" height="189" /></a>Facebook.. Could you live without facebook nowadays? Sometimes I&#8217;m happy when I don&#8217;t get anything on facebook, just to have a bit of peace and quiet of it.</p>
<p>Well, nevertheless, I&#8217;m writing this article because I&#8217;ve seen this post on the Adobe Forums by dmennenoh where he asked for the possibilities of using the Facebook AS3 API without Flex or AIR and the possibility of uploading pictures to Facebook.</p>
<p>Short answer: yes, it&#8217;s possible but&#8230;. it&#8217;s not a very well documented process of achieving it.</p>
<p>Before we start, I would like to recommend you a few tutorials on the Adobe Developer Connection, Jeanette Stallons wrote a whole series about the usage of the Facebook AS3 API, and it&#8217;s an absolute must read if you want to start developing flash applications or websites using facebook data and connectivity. First I recommend you starting with the <a href="http://www.adobe.com/devnet/facebook/articles/first_flex_facebook_desktop_app.html" target="_blank">Quick Start</a> to get a feeling for it, after that move on to <a href="http://www.adobe.com/devnet/facebook/articles/first_flex_facebook_web_app_pt1.html" target="_blank">Part 1: Build and Test Locally</a>, <a href="http://www.adobe.com/devnet/facebook/articles/first_flex_facebook_web_app_pt2.html" target="_blank">Part 2: Deploy on Facebook</a> and Part 3: <a href="http://www.adobe.com/devnet/facebook/articles/first_flex_facebook_web_app_pt3.html" target="_blank">Deploy using Facebook Connect</a><span id="more-740"></span></p>
<p>First of all before we start be sure to get the newest FacebookAS3 library, be sure to download the Flash version of it. At this point the current version is <a href="http://code.google.com/p/facebook-actionscript-api/downloads/detail?name=Facebook_library_v3.4_flash.swc" target="_blank">Facebook_library_v3.4_flash.swc</a> you can get newest version on the <a href="http://code.google.com/p/facebook-actionscript-api/" target="_blank">Project page</a>.</p>
<p>As I prefer using <a href="http://www.minimalcomps.com/" target="_blank">MinimalComps</a> by Keith Peters (aka. BIT-101) we are going to download his classes here. If you don&#8217;t know MinimalComps, it&#8217;s a set of components like you know from Flex or the Flash IDE, it contains the default set of components like button, textfield, textarea, but also has various interesting components like dials, calendars, knobs and much much more. I strongly recommend you read through the documentation and work through a few tutorials so you get your hands dirty with it.<br />
Again this is not a MUST-USE, I just feel more comfortable using these then any other components.</p>
<p>I strongly recommend to use the <a href="http://demonsterdebugger.com/" target="_blank">deMonsterDebugger</a> to trace events and data returned from facebook, it has a simple to use interface and is far better then the normal trace() functionality.</p>
<p><strong>1. Setup</strong><br />
1.1 Let&#8217;s start by opening Flash Builder and creating a new Actionscript Project with the name <em><strong>FacebookAS3</strong></em>. We are not going to use any Flex Components neither any AIR methods, you could also build this in the Flash IDE, but I prefer to use Flash Builder for it&#8217;s Code Completion features and it&#8217;s the tool I prefer when coding AS3.</p>
<p>1.2 Import the .SWC file by right clicking on the Project name and selecting <strong>Properties</strong>, then go to <strong>Actionscript Build Path </strong>and<strong> </strong>select the<strong> Library path</strong> tab, press the <strong>Add SWC</strong> button and locate the downloaded facebook_library_flash.swc you downloaded previously. Press OK and we are ready to go.</p>
<p>1.3 If you using MinimalComps for the UserInterface, don&#8217;t forget to import the source to your project so you can use them properly.</p>
<p>1.4 If you using deMonsterDebugger to trace and debug your application, don&#8217;t forget to import the needed classes to your project src folder.</p>
<p><strong>2. Login </strong><br />
Below you will find my main class that handles the whole login procedure of our small application.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const API_KEY	:<span style="color: #0066CC;">String</span>				= <span style="color: #ff0000;">&quot;xxxxx&quot;</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const SECRET	:<span style="color: #0066CC;">String</span>				= <span style="color: #ff0000;">&quot;xxxxx&quot;</span>;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _overlaySprite		:Sprite;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _userInterface		:UserInterface;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _photoBA			:ByteArray;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _fb					:Facebook;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _fbSession			:FacebookSessionUtil;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _userData			:FacebookUser;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _uid				:<span style="color: #0066CC;">String</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _batchCollection	:BatchCollection;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _batchRun			:BatchRun;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _albumArray			:<span style="color: #0066CC;">Array</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _uploadPhoto		:UploadPhoto;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			MonsterDebugger.<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #ff0000;">&quot;init - Facebook integration&quot;</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #0066CC;">stage</span>.<span style="color: #0066CC;">scaleMode</span> = StageScaleMode.<span style="color: #006600;">NO_SCALE</span>;
			<span style="color: #0066CC;">stage</span>.<span style="color: #0066CC;">align</span>		= StageAlign.<span style="color: #006600;">TOP_LEFT</span>;
&nbsp;
			_overlaySprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_overlaySprite.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xcccccc, <span style="color: #cc66cc;">0.5</span> <span style="color: #66cc66;">&#41;</span>;
			_overlaySprite.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageWidth</span>, <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageHeight</span> <span style="color: #66cc66;">&#41;</span>;
			_overlaySprite.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			addChild<span style="color: #66cc66;">&#40;</span> _overlaySprite <span style="color: #66cc66;">&#41;</span>;
			_overlaySprite.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">false</span>;
&nbsp;
			_userInterface				= <span style="color: #000000; font-weight: bold;">new</span> UserInterface<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_userInterface.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">SELECT</span>, uploadImage <span style="color: #66cc66;">&#41;</span>;
			addChild<span style="color: #66cc66;">&#40;</span> _userInterface <span style="color: #66cc66;">&#41;</span>;
			_userInterface.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">false</span>;
			login<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> login<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_fbSession					= <span style="color: #000000; font-weight: bold;">new</span> FacebookSessionUtil<span style="color: #66cc66;">&#40;</span> API_KEY, SECRET, loaderInfo <span style="color: #66cc66;">&#41;</span>;
			_fb							= _fbSession.<span style="color: #006600;">facebook</span>;
&nbsp;
			_fbSession.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> FacebookEvent.<span style="color: #0066CC;">CONNECT</span>, connectHandle <span style="color: #66cc66;">&#41;</span>;
			_fbSession.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> FacebookEvent.<span style="color: #006600;">WAITING_FOR_LOGIN</span>, loginWaitHandler <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			_fbSession.<span style="color: #006600;">login</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> connectHandle<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:FacebookEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
&nbsp;
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>.<span style="color: #006600;">success</span> <span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				_uid 					= <span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">data</span> as GetSessionData <span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">uid</span>;
&nbsp;
				_batchCollection		= <span style="color: #000000; font-weight: bold;">new</span> BatchCollection<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				_batchCollection.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> HasAppPermission<span style="color: #66cc66;">&#40;</span> HasAppPermissionValues.<span style="color: #006600;">PHOTO_UPLOAD</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
				_batchCollection.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> GetInfo<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span>_uid<span style="color: #66cc66;">&#93;</span>, <span style="color: #66cc66;">&#91;</span>GetInfoFieldValues.<span style="color: #006600;">FIRST_NAME</span>, GetInfoFieldValues.<span style="color: #006600;">CURRENT_LOCATION</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
				_batchCollection.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> GetAlbums<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
				_batchRun				= _fb.<span style="color: #006600;">post</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> BatchRun<span style="color: #66cc66;">&#40;</span> _batchCollection <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> as BatchRun;
				_batchRun.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> FacebookEvent.<span style="color: #006600;">COMPLETE</span>, batchCompleteHandler <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> batchCompleteHandler<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:FacebookEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>.<span style="color: #006600;">success</span> <span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span> results:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">data</span> as BatchResult <span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">results</span>;
&nbsp;
				<span style="color: #000000; font-weight: bold;">var</span> hasPermission:BooleanResultData = results<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>;
				<span style="color: #000000; font-weight: bold;">var</span> getInfoResult:GetInfoData = results<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>;
				<span style="color: #000000; font-weight: bold;">var</span> getAlbumsResult:GetAlbumsData = results<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span>;
&nbsp;
				<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">!</span>hasPermission.<span style="color: #006600;">value</span> <span style="color: #66cc66;">&#41;</span>
				<span style="color: #66cc66;">&#123;</span>
					MonsterDebugger.<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #ff0000;">&quot;no permission&quot;</span> <span style="color: #66cc66;">&#41;</span>;
					getPermissions<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #66cc66;">&#125;</span>
&nbsp;
					<span style="color: #808080; font-style: italic;">/*_userData = getInfoResult.userCollection.getItemAt(0) as FacebookUser;
					_userInterface.username = _userData.first_name + _userData.last_name;
					_userInterface.albumList = getAlbumsResult.albumCollection.toArray();*/</span>
&nbsp;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> getPermissions<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_fb.<span style="color: #006600;">grantExtendedPermission</span><span style="color: #66cc66;">&#40;</span> ExtendedPermissionValues.<span style="color: #006600;">PHOTO_UPLOAD</span> <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> uploadImage<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:Event <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_uploadPhoto = <span style="color: #000000; font-weight: bold;">new</span> UploadPhoto<span style="color: #66cc66;">&#40;</span>_userInterface.<span style="color: #006600;">snapshot</span><span style="color: #66cc66;">&#41;</span>;
			_fb.<span style="color: #006600;">post</span><span style="color: #66cc66;">&#40;</span>_uploadPhoto<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> loginWaitHandler<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:FacebookEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_overlaySprite.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">true</span>;
			_overlaySprite.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> MouseEvent.<span style="color: #006600;">CLICK</span>, confirmConnect <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> confirmConnect<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:MouseEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_overlaySprite.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">false</span>;
			_userInterface.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">true</span>;
			_overlaySprite.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span> MouseEvent.<span style="color: #006600;">CLICK</span>, confirmConnect <span style="color: #66cc66;">&#41;</span>;
			_fbSession.<span style="color: #006600;">validateLogin</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Let&#8217;s take a look at what&#8217;s happening here, first of all we create instances of the facebook and the facebooksessionutil classes, those are going to help using Facebook throughout the whole application.<br />
We setup an overlaysprite (this could also be a simple button or an alert panel) that will let us know when the user came back from the facebook login page. When the overlaysprite is clicked we validate the login and enable our userinterface. When the user is connected successfully to the application we start our BatchCollection to make multiple calls to FB, We check if the user has allowed permission to upload pictures, get his basic information like id, name and so on, and also get the album list from his profile<em> (currently not working due to API bug)</em><br />
When the batch is completed we assign the result to various variables and check the status of the extended permission if this is false, then we ask the user to confirm the permission so we are able to upload pictures, the getPermission() method.<br />
After that we are ready to move on to our interface.</p>
<p>In this example I&#8217;m not going to create a seamless experience with Facebook that you know from other applications mostly on Mobile Phones, that involves a bunch of HTML and Javascript scripting and is covered on Jeanette Stallons Part 3: <a href="http://www.adobe.com/devnet/facebook/articles/first_flex_facebook_web_app_pt3.html" target="_blank">Deploy using Facebook Connect</a></p>
<p><strong>3. Interface</strong> (UserInterface.as)<br />
Next up we are going to create a simple interface so you can preview the webcam image and take a snapshot, we also going to create a small logger window so we get informed about what&#8217;s going on without having to switch to the deMonsterDebugger to view the status. Therefore I&#8217;m going to create a custom class named <strong>UserInterface</strong> which will have the visual assets and placeholders for the data received.</p>
<p>Below the Userinterface.as class:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> UserInterface <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _video			:<span style="color: #0066CC;">Video</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _camera			:<span style="color: #0066CC;">Camera</span>;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _bitmap			:Bitmap;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _bitmapData			:BitmapData;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _snapshotBA			:ByteArray;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _pushButton			:PushButton;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _albumArray			:<span style="color: #0066CC;">Array</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _albumList			:<span style="color: #0066CC;">List</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> UserInterface<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			_camera				= <span style="color: #0066CC;">Camera</span>.<span style="color: #006600;">getCamera</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_camera.<span style="color: #0066CC;">setMode</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">640</span>, <span style="color: #cc66cc;">480</span>, <span style="color: #cc66cc;">25</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
			_video				= <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Video</span><span style="color: #66cc66;">&#40;</span> _camera.<span style="color: #0066CC;">width</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, _camera.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span>;
			_video.<span style="color: #006600;">attachCamera</span><span style="color: #66cc66;">&#40;</span> _camera <span style="color: #66cc66;">&#41;</span>;
			addChild<span style="color: #66cc66;">&#40;</span> _video <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			_pushButton				= <span style="color: #000000; font-weight: bold;">new</span> PushButton<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_pushButton.<span style="color: #0066CC;">width</span>			= <span style="color: #cc66cc;">80</span>;
			_pushButton.<span style="color: #006600;">x</span>				= _video.<span style="color: #0066CC;">width</span> - _pushButton.<span style="color: #0066CC;">width</span>;
			_pushButton.<span style="color: #006600;">y</span>				= _video.<span style="color: #0066CC;">height</span> + <span style="color: #cc66cc;">5</span>;
			_pushButton.<span style="color: #006600;">label</span>			= <span style="color: #ff0000;">&quot;CAPTURE&quot;</span>;
			_pushButton.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> MouseEvent.<span style="color: #006600;">CLICK</span>, createSnapshot <span style="color: #66cc66;">&#41;</span>;
			addChild<span style="color: #66cc66;">&#40;</span> _pushButton <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			_bitmapData				= <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span> _camera.<span style="color: #0066CC;">width</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, _camera.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span>;
			_bitmap					= <span style="color: #000000; font-weight: bold;">new</span> Bitmap<span style="color: #66cc66;">&#40;</span> _bitmapData <span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> createSnapshot<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:MouseEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_bitmapData.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span> _video <span style="color: #66cc66;">&#41;</span>;
			_video.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">false</span>;
			addChild<span style="color: #66cc66;">&#40;</span> _bitmap <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> enc:JPGEncoder = <span style="color: #000000; font-weight: bold;">new</span> JPGEncoder<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">80</span> <span style="color: #66cc66;">&#41;</span>;
			_snapshotBA = enc.<span style="color: #006600;">encode</span><span style="color: #66cc66;">&#40;</span> _bitmapData <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			_pushButton.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span> MouseEvent.<span style="color: #006600;">CLICK</span>, createSnapshot <span style="color: #66cc66;">&#41;</span>;
			_pushButton.<span style="color: #006600;">label</span> = <span style="color: #ff0000;">&quot;UPLOAD IMAGE&quot;</span>;
			_pushButton.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> MouseEvent.<span style="color: #006600;">CLICK</span>, sendSnapshot <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> sendSnapshot<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:MouseEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			dispatchEvent<span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">SELECT</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> createList<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_albumList			= <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">List</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">this</span>, _video.<span style="color: #006600;">x</span> + _video.<span style="color: #0066CC;">width</span> + <span style="color: #cc66cc;">20</span>, _video.<span style="color: #006600;">y</span>, _albumArray <span style="color: #66cc66;">&#41;</span>;
			addChild<span style="color: #66cc66;">&#40;</span> _albumList <span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> albumList<span style="color: #66cc66;">&#40;</span> arr:<span style="color: #0066CC;">Array</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_albumArray = arr;
			<span style="color: #808080; font-style: italic;">//MonsterDebugger.trace(this, _albumArray );</span>
			<span style="color: #808080; font-style: italic;">//createList();</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> snapshot<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:ByteArray
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">return</span> _snapshotBA;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>As you see I&#8217;m creaing a Camera instance with the size of 640x480px and attaching it to a video class to be displayed on the stage at halfsize, you could also keep it the full size but I prefer working with the 320&#215;240 format.<br />
The Bitmap and BitmapData instances are created and create a getter to return the bytearray to our mainapplication.</p>
<p><strong>4. Using the Webcam</strong><br />
Let&#8217;s take a quicklook what we are doing to take a snapshot of the webcam and how to prepare the image to be uploaded to Facebook. As mentioned on my previous post we take a snapshot of the webcam by creating a bitmapdata of it, then we use the JPGEncoder classes from the AS3Corelib <em>(these are as well already inside the AS3Facebook Library)</em> and encode them into a ByteArray.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> createSnapshot<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:MouseEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_bitmapData.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span> _video <span style="color: #66cc66;">&#41;</span>;
			_video.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">false</span>;
			addChild<span style="color: #66cc66;">&#40;</span> _bitmap <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> enc:JPGEncoder = <span style="color: #000000; font-weight: bold;">new</span> JPGEncoder<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">80</span> <span style="color: #66cc66;">&#41;</span>;
			_snapshotBA = enc.<span style="color: #006600;">encode</span><span style="color: #66cc66;">&#40;</span> _bitmapData <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p><strong>5. Choosing Album and uploading Picture</strong><br />
As mentioned before there is currently a bug with the AS3Facebook API 3.4, you cannot get the Albumlist from the logged in user, even if you give the application the proper extended permissions. So in our case we are just going to upload our photos to the default album, now you&#8217;re asking what&#8217;s the default album?</p>
<p>It&#8217;s not very clear to me as well, but basically Facebook creates a Photoalbum for every application that uploads an image to it, let&#8217;s say your application is called &#8220;APU&#8221; the user using the application will get a APU PhotoGallery folder in his profile. So choose wisely what name your application will have.</p>
<p>Below the upload code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> uploadImage<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:Event <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_uploadPhoto = <span style="color: #000000; font-weight: bold;">new</span> UploadPhoto<span style="color: #66cc66;">&#40;</span>_userInterface.<span style="color: #006600;">snapshot</span><span style="color: #66cc66;">&#41;</span>;
			_fb.<span style="color: #006600;">post</span><span style="color: #66cc66;">&#40;</span>_uploadPhoto<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>That&#8217;s it, the most difficult part developing applications using Facebook is barely the way the whole data communication works, the API is very stable and things work well ( let&#8217;s forget the GetAlbum bug ).<br />
Most tutorials out there have been written for Flex or AIR, simply because it gives you the best userinterface to handle FB needs nevertheless I prefer using pure AS3.</p>
<p>This time I didn&#8217;t want to create a nice interface to use it, as this is solely a programming article, feel free to modify it, download it, share it, whatever you would like to do with it.</p>
<p>You can download the project here: <a href="http://blog.six4rty.ch/wp-content/uploads/2010/07/Facebook-AS3.zip">Source  (Flash Builder Project)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.six4rty.ch/2010/07/17/as3-facebook-uploading-webcam-photos/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/2.5/ch/</creativeCommons:license>
	</item>
		<item>
		<title>AS3: QuickHint: Convert BitmapData to ByteArray</title>
		<link>http://blog.six4rty.ch/2010/07/17/as3-quickhint-convert-bitmapdata-to-bytearray/</link>
		<comments>http://blog.six4rty.ch/2010/07/17/as3-quickhint-convert-bitmapdata-to-bytearray/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 01:30:12 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Quick Hints]]></category>
		<category><![CDATA[AS3.0]]></category>
		<category><![CDATA[Bitmap]]></category>
		<category><![CDATA[ByteArray]]></category>

		<guid isPermaLink="false">http://blog.six4rty.ch/?p=754</guid>
		<description><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F07%252F17%252Fas3-quickhint-convert-bitmapdata-to-bytearray%252F&title=AS3%3A+QuickHint%3A+Convert+BitmapData+to+ByteArray&desc=While+writing+my+next+post%2C+about+Facebook+and+Flash+development%2C+I+noticed+that+there+is+something+in+my+post+drafts+that+I+haven%27t+published+yet%2C+so+I+changed+it+a+bit+and+here+you+go.%0D%0A%0D%0AOn+one+of+&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div>While writing my next post, about Facebook and Flash development, I noticed that there is something in my post drafts that I haven&#8217;t published yet, so I changed it a bit and here you go. On one of my last posts taking a screenshot with AS3 I&#8217;ve explained how to create a snapshot by using [...]]]></description>
			<content:encoded><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F07%252F17%252Fas3-quickhint-convert-bitmapdata-to-bytearray%252F&title=AS3%3A+QuickHint%3A+Convert+BitmapData+to+ByteArray&desc=While+writing+my+next+post%2C+about+Facebook+and+Flash+development%2C+I+noticed+that+there+is+something+in+my+post+drafts+that+I+haven%27t+published+yet%2C+so+I+changed+it+a+bit+and+here+you+go.%0D%0A%0D%0AOn+one+of+&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p><a href="http://blog.six4rty.ch/wp-content/uploads/2010/07/as3code.jpg"><img class="alignleft size-medium wp-image-724" style="margin: 10px;" title="as3code" src="http://blog.six4rty.ch/wp-content/uploads/2010/07/as3code-300x270.jpg" alt="" width="210" height="189" /></a>While writing my next post, about Facebook and Flash development, I noticed that there is something in my post drafts that I haven&#8217;t published yet, so I changed it a bit and here you go.</p>
<p>On one of my last posts <a href="http://blog.six4rty.ch/2010/07/11/as3-take-a-screenshot-of-displayobject/" target="_blank">taking a screenshot with AS3</a> I&#8217;ve explained how to create a snapshot by using the Bitmap and the BitmapData classes.</p>
<p>Sometimes you need to convert the bitmaps to bytearrays to send them to a server-side script, save it directly to an AIR database or send it with AMF.</p>
<p>Something that is still a bit unclear, is how to convert the freshly created BitmapData to a ByteArray, there are no methods available in the default packages that come along with Flash Builder or Flash Professional, there are a few other ways, but they are in my opinion not really the best way on doing it. After all we all like to write short, smart clean code right?<br />
<span id="more-754"></span><br />
Make sure you download the <a href="http://code.google.com/p/as3corelib/source/browse/#svn/trunk/src/com/adobe/images" target="_blank">JPG/PNG Encoder</a> classes from the <a href="http://code.google.com/p/as3corelib/" target="_blank">AS3 corelib,</a> without these you will not be able to create a proper bytearray of the snapshot,</p>
<p>To start off, let&#8217;s refresh our memory on how to create a bitmapdata.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">_bitmapData					= <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span> _sprite.<span style="color: #0066CC;">width</span>, _sprite.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">&#41;</span>;
_bitmap						= <span style="color: #000000; font-weight: bold;">new</span> Bitmap<span style="color: #66cc66;">&#40;</span> _bitmapData <span style="color: #66cc66;">&#41;</span>;
_bitmapData.<span style="color: #006600;">draw</span> <span style="color: #66cc66;">&#40;</span> _sprite <span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span> _bitmap <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Now that we remember how we create the bitmapdata object, let&#8217;s move on to the creation of a ByteArray, don&#8217;t be afraid it&#8217;s really easy, and it doesn&#8217;t cost you more then two lines of code.</p>
<pre lang ="actionscript">
var enc:JPGEncoder = new JPGEncoder( 80 );
var _snapshotBA = enc.encode( _bitmapData );
</pre>
<p>That was it, as you see, I kept my promise, only 2 lines of code to create a ByteArray.</p>
<p>Stay tuned for the next post.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.six4rty.ch/2010/07/17/as3-quickhint-convert-bitmapdata-to-bytearray/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/2.5/ch/</creativeCommons:license>
	</item>
		<item>
		<title>AS3: Drawing dynamic anchor lines</title>
		<link>http://blog.six4rty.ch/2010/07/13/as3-drawing-dynamic-anchor-lines/</link>
		<comments>http://blog.six4rty.ch/2010/07/13/as3-drawing-dynamic-anchor-lines/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 18:14:12 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Quick Hints]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[Drawing]]></category>

		<guid isPermaLink="false">http://blog.six4rty.ch/?p=732</guid>
		<description><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F07%252F13%252Fas3-drawing-dynamic-anchor-lines%252F&title=AS3%3A+Drawing+dynamic+anchor+lines&desc=Based+on+this+post+on+the+Adobe%27s+AS3+forum%2C+I+thought%C2%A0+I+would+create+a+simple+class+that+takes+care+of+the+requested+task.%0D%0A%0D%0AThe+whole+idea+is+basically+to+draw+a+line+dynamically+between+2+displa&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div>Based on this post on the Adobe&#8217;s AS3 forum, I thought  I would create a simple class that takes care of the requested task. The whole idea is basically to draw a line dynamically between 2 displayobjects, on top of it when one object is being dragged the line is redrawn along based on the [...]]]></description>
			<content:encoded><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F07%252F13%252Fas3-drawing-dynamic-anchor-lines%252F&title=AS3%3A+Drawing+dynamic+anchor+lines&desc=Based+on+this+post+on+the+Adobe%27s+AS3+forum%2C+I+thought%C2%A0+I+would+create+a+simple+class+that+takes+care+of+the+requested+task.%0D%0A%0D%0AThe+whole+idea+is+basically+to+draw+a+line+dynamically+between+2+displa&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p><a href="http://blog.six4rty.ch/wp-content/uploads/2010/07/as3code.jpg"><img class="size-medium wp-image-724 alignleft" style="margin: 10px;" title="as3code" src="http://blog.six4rty.ch/wp-content/uploads/2010/07/as3code-300x270.jpg" alt="" width="210" height="189" /></a>Based on <a href="http://forums.adobe.com/thread/669998?tstart=0" target="_blank">this</a> post on the Adobe&#8217;s AS3 forum, I thought  I would create a simple class that takes care of the requested task.</p>
<p>The whole idea is basically to draw a line dynamically between 2 displayobjects, on top of it when one object is being dragged the line is redrawn along based on the second sprite position.</p>
<p>There is  a lot more that can be done, like avoiding other sprites, drawing multiple lines attached to multiple buttons and so on. but I think this class can give you a good head start for future implementations.</p>
<p>First of all there are a few things that we need to consider before starting, let&#8217;s take a look at the first few tasks</p>
<p>1. Every Sprite needs to know to which button it has been linked to. You need to store this somewhere.<br />
2. Every Sprite needs a specific anchor point that is used as endpoint of the drawn line.<br />
3. As soon the drag method is started we need to know where  the one end of the line (from the sprite that is not being dragged by the mouse) is positioned at. This is something that we really need to do once on a startDrag method.</p>
<p>Here&#8217;s what I&#8217;ve done:<span id="more-732"></span><br />
Based on the notices above, I&#8217;ve created a new Class called ConnectedSprite a simple class which extends the Sprite Class but with a few more options that helps us towards our goal and this is how our class looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">DisplayObject</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">Point</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ConnectedSprite <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _anchorPoint			:Point;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _relativeObject		:ConnectedSprite;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ConnectedSprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> anchorPoint <span style="color: #66cc66;">&#40;</span> p:Point <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_anchorPoint = p;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> anchorPoint<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:Point
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">return</span> _anchorPoint;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> relativeObject <span style="color: #66cc66;">&#40;</span> co:ConnectedSprite <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_relativeObject = co;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> relativeObject<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:ConnectedSprite
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">return</span> _relativeObject;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Just to give you quick overview of what we are doing here:<br />
Basically we are extending the Sprite class and adding two new variables _<strong>anchorPoint</strong> and _<strong>relativeObject</strong>, those are accessible by using getters &amp; setters.<br />
The _anchorpoint variable holds a fixed x and y position where our line should connect to and the _relativeObject has a reference to the other sprite which is being conntected to.<br />
Pretty simple but effective.</p>
<p>That was already it, we now just need to create two new ConnectedSprite instances pass the needed values and there you go, below the BaseClass I&#8217;ve built for this example:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> AnchoredSprite <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _spriteA			:ConnectedSprite;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _spriteB			:ConnectedSprite;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _movingTarget		:ConnectedSprite;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _staticTargetPos		:Point		= <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _connector			:Sprite;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> AnchoredSprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			_connector = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			addChild<span style="color: #66cc66;">&#40;</span> _connector <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			_spriteA = <span style="color: #000000; font-weight: bold;">new</span> ConnectedSprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_spriteA.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span> 0xff0000, <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span>;
			_spriteA.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">50</span>, <span style="color: #cc66cc;">50</span> <span style="color: #66cc66;">&#41;</span>;
			_spriteA.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_spriteA.<span style="color: #006600;">anchorPoint</span> = <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span> _spriteA.<span style="color: #0066CC;">width</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, _spriteA.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span>;
			addChild<span style="color: #66cc66;">&#40;</span> _spriteA <span style="color: #66cc66;">&#41;</span>;
			_spriteA.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> MouseEvent.<span style="color: #006600;">MOUSE_DOWN</span>, mouseDownHandler <span style="color: #66cc66;">&#41;</span>;
			_spriteA.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> MouseEvent.<span style="color: #006600;">MOUSE_UP</span>, mouseUpHandler <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			_spriteB = <span style="color: #000000; font-weight: bold;">new</span> ConnectedSprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_spriteB.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span> 0x0000ff, <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span>;
			_spriteB.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">50</span>, <span style="color: #cc66cc;">50</span> <span style="color: #66cc66;">&#41;</span>;
			_spriteB.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_spriteB.<span style="color: #006600;">anchorPoint</span> = <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span> _spriteB.<span style="color: #0066CC;">width</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, _spriteB.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span>;
			addChild<span style="color: #66cc66;">&#40;</span> _spriteB <span style="color: #66cc66;">&#41;</span>;
			_spriteB.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> MouseEvent.<span style="color: #006600;">MOUSE_DOWN</span>, mouseDownHandler <span style="color: #66cc66;">&#41;</span>;
			_spriteB.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> MouseEvent.<span style="color: #006600;">MOUSE_UP</span>, mouseUpHandler <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			_spriteA.<span style="color: #006600;">relativeObject</span> = _spriteB;
			_spriteB.<span style="color: #006600;">relativeObject</span> = _spriteA;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> mouseDownHandler<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:MouseEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">startDrag</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">false</span> <span style="color: #66cc66;">&#41;</span>;
			_movingTarget = <span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">target</span> as ConnectedSprite;
			_staticTargetPos.<span style="color: #006600;">x</span> = _movingTarget.<span style="color: #006600;">relativeObject</span>.<span style="color: #006600;">x</span> + _movingTarget.<span style="color: #006600;">relativeObject</span>.<span style="color: #006600;">anchorPoint</span>.<span style="color: #006600;">x</span>;
			_staticTargetPos.<span style="color: #006600;">y</span> = _movingTarget.<span style="color: #006600;">relativeObject</span>.<span style="color: #006600;">y</span> + _movingTarget.<span style="color: #006600;">relativeObject</span>.<span style="color: #006600;">anchorPoint</span>.<span style="color: #006600;">y</span>;
			addEventListener<span style="color: #66cc66;">&#40;</span> MouseEvent.<span style="color: #006600;">MOUSE_MOVE</span>, drawLine <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> mouseUpHandler<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:MouseEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">stopDrag</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_movingTarget = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
			removeEventListener<span style="color: #66cc66;">&#40;</span> MouseEvent.<span style="color: #006600;">MOUSE_MOVE</span>, drawLine <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> drawLine<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:MouseEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_connector.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_connector.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">1</span>, 0x333333 <span style="color: #66cc66;">&#41;</span>;
			_connector.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">moveTo</span><span style="color: #66cc66;">&#40;</span> _staticTargetPos.<span style="color: #006600;">x</span>, _staticTargetPos.<span style="color: #006600;">y</span> <span style="color: #66cc66;">&#41;</span>;
			_connector.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span> _movingTarget.<span style="color: #006600;">x</span> + _movingTarget.<span style="color: #006600;">anchorPoint</span>.<span style="color: #006600;">x</span>, _movingTarget.<span style="color: #006600;">y</span> + _movingTarget.<span style="color: #006600;">anchorPoint</span>.<span style="color: #006600;">y</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">updateAfterEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>it&#8217;s quite a long base class for this simple task, it could have been reduced using other drawing methods, but that is something that I leave up to you.</p>
<p>Below a working example and you can download the source files here: <a href="http://blog.six4rty.ch/wp-content/uploads/2010/07/ConnectedSprite.zip">ConnectedSprite</a></p>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_2" width="400" height="300">
      <param name="movie" value="http://blog.six4rty.ch/wp-content/uploads/2010/07/AnchoredSprite1.swf" />
      <param name="allowfullscreen" value="true" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://blog.six4rty.ch/wp-content/uploads/2010/07/AnchoredSprite1.swf" width="400" height="300" allowfullscreen="true">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>

]]></content:encoded>
			<wfw:commentRss>http://blog.six4rty.ch/2010/07/13/as3-drawing-dynamic-anchor-lines/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/2.5/ch/</creativeCommons:license>
	</item>
		<item>
		<title>SWFObject &amp; SWFAddress &#8211; compatibility</title>
		<link>http://blog.six4rty.ch/2010/07/09/swfobject-swfaddress-compatibility/</link>
		<comments>http://blog.six4rty.ch/2010/07/09/swfobject-swfaddress-compatibility/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 12:40:37 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[SWFAddress]]></category>
		<category><![CDATA[SWFObject]]></category>

		<guid isPermaLink="false">http://blog.six4rty.ch/?p=708</guid>
		<description><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F07%252F09%252Fswfobject-swfaddress-compatibility%252F&title=SWFObject+%26+SWFAddress+-+compatibility&desc=%0D%0A%0D%0AWho+doesn%27t+know+SWFObject+%26amp%3B+SWFAddress%3F+These+two+JavaScript+buddies+are+the+best+a+serious+Flash+Developer+can+have.%0D%0A%0D%0ASWFObject+embeds+your+Flash+nicely+and+browser+independent%2C+it+has+gon&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div>Who doesn&#8217;t know SWFObject &#38; SWFAddress? These two JavaScript buddies are the best a serious Flash Developer can have. SWFObject embeds your Flash nicely and browser independent, it has gone a long way and now it&#8217;s even the default publishing method in Flash Builder and Flash Catalyst (not sure about Flash CS5 ), you can [...]]]></description>
			<content:encoded><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F07%252F09%252Fswfobject-swfaddress-compatibility%252F&title=SWFObject+%26+SWFAddress+-+compatibility&desc=%0D%0A%0D%0AWho+doesn%27t+know+SWFObject+%26amp%3B+SWFAddress%3F+These+two+JavaScript+buddies+are+the+best+a+serious+Flash+Developer+can+have.%0D%0A%0D%0ASWFObject+embeds+your+Flash+nicely+and+browser+independent%2C+it+has+gon&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p><a href="http://blog.six4rty.ch/wp-content/uploads/2010/07/swfObjaddImg.jpg"><img class="alignnone size-medium wp-image-709" title="swfObjaddImg" src="http://blog.six4rty.ch/wp-content/uploads/2010/07/swfObjaddImg-300x90.jpg" alt="" width="300" height="90" /></a></p>
<p>Who doesn&#8217;t know SWFObject &amp; SWFAddress? These two JavaScript buddies are the best a serious Flash Developer can have.</p>
<p><a href="http://code.google.com/p/swfobject/" target="_blank">SWFObject </a>embeds your Flash nicely and browser independent, it has gone a long way and now it&#8217;s even the default publishing method in Flash Builder and Flash Catalyst (not sure about Flash CS5 ), you can read a more detailed history on the <a href="http://code.google.com/p/swfobject/wiki/history" target="_blank">projects history site</a>.</p>
<p><a href="http://www.asual.com/swfaddress/" target="_blank">SWFAddress </a>is a small library that provides deep-linking functionality in your Flash projects, it enables you to create unique virtual URL&#8217;s which enables Search Engines to index your flash content and of course the utilisation of the browsers back and forward buttons eg. history capabilities.<br />
<span id="more-708"></span></p>
<p>Usually in our development process we integrate these 2 buddies right at the beginning of the project, before we even code any AS3 line, these two are already in the html template inside FlashBuilder. Last time I started a new project I downloaded the latest versions (at that time) from these libraries and implemented them. Everything was working fine, and it works fine, but sadly only on FF3+ and IE8.. what happened to the strength of SWFObject?</p>
<p>After scrolling through a few posts and forums I decided to gradually downgrade every version of each Library backwards to see what happens. I must mention that the default embedding and display of flash content works perfectly, but when you need to send flashvars or parameters to your swf, there&#8217;s when things break.</p>
<p><strong>Solution?</strong><br />
It&#8217;s an easy one, but painful to find out as it took me a few hours to get it to work.<br />
SWFObject and SWFAddress are in deed buddies, but they need to be coordinated  properly.</p>
<p><strong>First pitfall:</strong><br />
The order that the javascript is being placed is very important, you <strong>NEED </strong>to place it in the order:<br />
1. SWFObject 2. SWFAddress all other Javascripts you might have in place shouldn&#8217;t bother these two, but it&#8217;s always safer to put your custom stuff after the SWFAddress import.</p>
<p><strong>Second pitfall:</strong><br />
There are various versions of each library some work together some don&#8217;t. I didn&#8217;t had the time to create a nice working table, but I promise you that I&#8217;m going to post one in the near future, but I can tell you what definately works 100%, SWFObject 2.2 &amp; SWFAddress 2.2, yes both libraries with the same version number.</p>
<p><strong>Third pitfall:</strong><br />
Sometimes ( I can&#8217;t tell you in which formation ) flashvars as parameters don&#8217;t get through to the SWF, the only workaround I found was to instead of using a parameters array I&#8217;ve passed an arguments array, that fixed all the troubles.</p>
<p>I know it&#8217; s weird and I would like to elaborate more on this, but currently I just don&#8217;t have the time to do it, but don&#8217;t be afraid I will get a list up soon with my testing results.<br />
If you have any questions to this topic, drop me a line and I will try to help you out.</p>
<p><strong>UPDATE:</strong><br />
Changed version numbers from 2.3 to 2.2, thanks to Ven</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.six4rty.ch/2010/07/09/swfobject-swfaddress-compatibility/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/2.5/ch/</creativeCommons:license>
	</item>
		<item>
		<title>Must have: SWFFit</title>
		<link>http://blog.six4rty.ch/2010/07/09/must-have-swffit/</link>
		<comments>http://blog.six4rty.ch/2010/07/09/must-have-swffit/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 10:09:41 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.six4rty.ch/?p=700</guid>
		<description><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F07%252F09%252Fmust-have-swffit%252F&title=Must+have%3A+SWFFit&desc=%0D%0A%0D%0ADuring+the+last+project+I+worked+on+for+ChocolatFrey+I+had+a+small+problem+that+was+bugging+me.+with+the+help+of+our+inhouse+stagemanager+class+where+you+can+define+minimum+width+%26amp%3B+height+of+t&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div>During the last project I worked on for ChocolatFrey I had a small problem that was bugging me. with the help of our inhouse stagemanager class where you can define minimum width &#38; height of the stage the flash website always looked good, but as sson as the screen was smaller then the minimum defined [...]]]></description>
			<content:encoded><![CDATA[<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=Tiago%26%23039%3Bs+Weblog&link=http%253A%252F%252Fblog.six4rty.ch%252F2010%252F07%252F09%252Fmust-have-swffit%252F&title=Must+have%3A+SWFFit&desc=%0D%0A%0D%0ADuring+the+last+project+I+worked+on+for+ChocolatFrey+I+had+a+small+problem+that+was+bugging+me.+with+the+help+of+our+inhouse+stagemanager+class+where+you+can+define+minimum+width+%26amp%3B+height+of+t&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=six4rty&twrelated1=&twrelated2=&twctr=1&lnkdshow=show&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=0&diggbutton=1&diggctr=0&stblbutton=1&stblctr=0&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p><a href="http://blog.six4rty.ch/wp-content/uploads/2010/07/swffit_logo.gif"><img class="alignnone size-full wp-image-701" title="swffit_logo" src="http://blog.six4rty.ch/wp-content/uploads/2010/07/swffit_logo.gif" alt="" width="123" height="92" /></a></p>
<p>During the last project I worked on for <a title="Chocolat Frey" href="http://www.chocolatfrey.com" target="_blank">ChocolatFrey</a> I had a small problem that was bugging me. with the help of our inhouse stagemanager class where you can define minimum width &amp; height of the stage the flash website always looked good, but as sson as the screen was smaller then the minimum defined width &amp; height it broke the layout.<br />
After a few minutes of searching I found this awesome little JavaScript called <a href="http://swffit.millermedeiros.com/" target="_blank">SWFFit </a>it resizes the flash movie based on the minimum dimensions set.</p>
<p>The usage of it is let&#8217;s say SIMPLE!! Even if you didn&#8217;t really care about JS, you can easily understand how it works, this is a simple example of how to use it:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">swffit.<span style="color: #660066;">fit</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;my_flash&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">960</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">670</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><span id="more-700"></span><br />
What the script above would do, is just create browser scrollbars when the defined size has been reached.<br />
You can even set more options like min/max width &amp; height and how the flash content should be centered.</p>
<p>Below a short explanation of the possible options:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">swffit.<span style="color: #660066;">fit</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'flashID'</span><span style="color: #339933;">,</span> minW<span style="color: #339933;">,</span> minH<span style="color: #339933;">,</span> maxW<span style="color: #339933;">,</span> maxH<span style="color: #339933;">,</span> hCenter<span style="color: #339933;">,</span> vCenter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>flashID: the id of the flash embed/object tag<br />
minW: minimum width in pixels<br />
minH: minimum height in pixels<br />
maxW: maximum width in pixels<br />
maxH: maximumheight in pixels<br />
hCenter: flash content will be centered horizontally when the maximum size has been reached ( Boolean )<br />
vCenter: flash content will be centered vertically when the maximum size has  been reached ( Boolean )</p>
<p>This is one of the Javascripts that should always be handy as Flash Developer together with <a href="http://code.google.com/p/swfobject/" target="_blank">SWFObject </a>&amp; <a href="http://www.asual.com/swfaddress/" target="_blank">SWFAddress</a>.</p>
<p>So go have a look at it, and try it out, I can only recommend it and give a big thank you out to <a href="http://www.millermedeiros.com/" target="_blank">Miller Medeiros</a> for sharing this with us.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.six4rty.ch/2010/07/09/must-have-swffit/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/2.5/ch/</creativeCommons:license>
	</item>
	</channel>
</rss>

