<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>distriqt // labs &#187; experiments</title>
	<atom:link href="http://labs.distriqt.com/category/experiments/feed" rel="self" type="application/rss+xml" />
	<link>http://labs.distriqt.com</link>
	<description>flash platform &#38; digital development australia</description>
	<lastBuildDate>Fri, 27 Jan 2012 00:24:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Quick Android Notification Example</title>
		<link>http://labs.distriqt.com/post/648</link>
		<comments>http://labs.distriqt.com/post/648#comments</comments>
		<pubDate>Wed, 20 Jul 2011 06:42:25 +0000</pubDate>
		<dc:creator>Michael Archbold</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://labs.distriqt.com/?p=648</guid>
		<description><![CDATA[So we all know and love our Android notification bar. So I just wanted to post a quick example application to show how easy it is to display a local notification. The process runs something like this: retrieve a reference to the NotificationManager create a Notification notify the manager of the notification you've created The [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Flabs.distriqt.com%2Fpost%2F648"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Flabs.distriqt.com%2Fpost%2F648&amp;source=distriqt&amp;style=normal&amp;service=bit.ly&amp;service_api=R_d2c0f1a5509cd228ab0be545d628ad7a&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img src="http://labs.distriqt.com/wordpress/wp-content/uploads/2011/07/notification_helloworld.jpg" alt="" title="notification_helloworld" width="580" height="292" class="aligncenter size-full wp-image-661" /></p>
<p>So we all know and love our Android notification bar. So I just wanted to post a quick example application to show how easy it is to display a local notification.</p>
<p>The process runs something like this:</p>
<ul>
<li>retrieve a reference to the NotificationManager</li>
<li>create a Notification</li>
<li>notify the manager of the notification you've created</li>
</ul>
<p><span id="more-648"></span></p>
<p>The Notification class, at it's simplest consists of an image icon and 3 pieces of text, one for the ticker, one as the title and the last as the content text.</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">package</span> com.<span style="color: #006600;">distriqt</span>.<span style="color: #006600;">mobile</span>.<span style="color: #006600;">experiments</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import android.app.Activity;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import android.app.Notification;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import android.app.NotificationManager;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import android.app.PendingIntent;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import android.content.Context;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import android.content.Intent;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import android.os.Bundle;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> NotificationExperimentActivity <span style="color: #000000; font-weight: bold;">extends</span> Activity</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #993333;">int</span> HELLO_ID = <span style="color: #cc66cc;">1</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    @Override</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> onCreate<span style="color: #66cc66;">&#40;</span>Bundle savedInstanceState<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006600;">onCreate</span><span style="color: #66cc66;">&#40;</span>savedInstanceState<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        setContentView<span style="color: #66cc66;">&#40;</span>R.<span style="color: #006600;">layout</span>.<span style="color: #006600;">main</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        <span style="color: #808080; font-style: italic;">//</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #808080; font-style: italic;">//  Look up the notification manager server</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        NotificationManager nm =</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">          <span style="color: #66cc66;">&#40;</span>NotificationManager<span style="color: #66cc66;">&#41;</span> getSystemService<span style="color: #66cc66;">&#40;</span>NOTIFICATION_SERVICE<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        <span style="color: #808080; font-style: italic;">//</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        <span style="color: #808080; font-style: italic;">//  Create your notification</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        <span style="color: #993333;">int</span> icon = R.<span style="color: #006600;">drawable</span>.<span style="color: #006600;">icon</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        CharSequence tickerText = <span style="color: #ff0000;">&quot;Hello&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        <span style="color: #993333;">long</span> when = <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">currentTimeMillis</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        Notification notification =</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">            <span style="color: #000000; font-weight: bold;">new</span> Notification<span style="color: #66cc66;">&#40;</span> icon, tickerText, when<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AContext+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Context</span></a> context = getApplicationContext<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        CharSequence contentTitle = <span style="color: #ff0000;">&quot;My notification&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        CharSequence contentText = <span style="color: #ff0000;">&quot;Hello World!&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        Intent notificationIntent =</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">            <span style="color: #000000; font-weight: bold;">new</span> Intent<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, NotificationExperimentIntent.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        PendingIntent contentIntent =</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">            PendingIntent.<span style="color: #006600;">getActivity</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #cc66cc;">0</span>, notificationIntent, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        notification.<span style="color: #006600;">setLatestEventInfo</span><span style="color: #66cc66;">&#40;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">            context,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">            contentTitle,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">            contentText,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">            contentIntent<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        <span style="color: #808080; font-style: italic;">//</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        <span style="color: #808080; font-style: italic;">//  Send the notification</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        nm.<span style="color: #006600;">notify</span><span style="color: #66cc66;">&#40;</span> HELLO_ID, notification <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li></ol></pre>
<p>The Android developer documentation goes through all of this in detail <a href="http://developer.android.com/guide/topics/ui/notifiers/notifications.html">here</a>.</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="tall" count="1" href="http://labs.distriqt.com/post/648"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://labs.distriqt.com/post/648/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KML Loader Update</title>
		<link>http://labs.distriqt.com/post/577</link>
		<comments>http://labs.distriqt.com/post/577#comments</comments>
		<pubDate>Sun, 19 Jun 2011 11:53:42 +0000</pubDate>
		<dc:creator>Michael Archbold</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[google-maps]]></category>
		<category><![CDATA[kml]]></category>

		<guid isPermaLink="false">http://labs.distriqt.com/?p=577</guid>
		<description><![CDATA[So as many people know, I've been promising an update to the KML Loader for a while now, and even to the point where I've had some local revisions and haven't had the time to check them in (I know, I know, bad practice!) The major update has been to enable the ability to load [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Flabs.distriqt.com%2Fpost%2F577"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Flabs.distriqt.com%2Fpost%2F577&amp;source=distriqt&amp;style=normal&amp;service=bit.ly&amp;service_api=R_d2c0f1a5509cd228ab0be545d628ad7a&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>So as many people know, I've been promising an update to the KML Loader for a while now, and even to the point where I've had some local revisions and haven't had the time to check them in (I know, I know, bad practice!)</p>
<p><a href="http://labs.distriqt.com/wordpress/wp-content/uploads/2011/06/kmlloader_groundoverlay.png" rel="shadowbox[sbpost-577];player=img;"><img src="http://labs.distriqt.com/wordpress/wp-content/uploads/2011/06/kmlloader_groundoverlay.png" alt="" title="KML Loader showing a Ground Overlay" width="580" height="352" class="aligncenter size-full wp-image-580" /></a></p>
<p>The major update has been to enable the ability to load linked assets. Initially this just extends to ground overlays and custom icons, but now that I have the structure setup to do this I'll be able to add in linked files and styles easily. </p>
<p><span id="more-577"></span></p>
<p>Other updates include a series of bug fixes, features with multiple geometries now load in correctly and I've updated the utility library to correctly parse the newer OGC KML namespace.</p>
<p>Some things to note:</p>
<ul>
<li>I've added a trunk directory to keep the main head revision separate from the tag tree</li>
<li>I've removed the included version of the google maps utility library. I've committed in some changes to this library so I didn't want to have to maintain it in two places, so you'll now have to go to the google maps utility library on google code <a href="http://code.google.com/p/gmaps-utility-library-flash/" target="_blank">here</a> (I'll package it all up at the end of this post as well).</li>
<li>I've tagged the previous version of the library if you wish to keep using it, you'll find it at: <code>http://svn.distriqt.com/public/trunk/gmaps/tags/R20101004_gmaps_utils_v1.0</code></li>
<li>I've used the <a href="https://github.com/arthur-debert/BulkLoader" target="_blank">BulkLoader</a> by Arthur Debert and have included it in the repository. This is used to load all the linked assets.</li>
</ul>
<p>The functionality should be exactly the same as the previous version, so you can still refer to the post on <a href="http://labs.distriqt.com/post/421">interactions</a>, about the <a href="http://labs.distriqt.com/post/251">SimpleKMLLoader</a> and the initial post about the <a href="http://labs.distriqt.com/post/164">KmlLoader</a>. </p>
<p>The major change is that you now need to grab the gmaps utility library separately and put both libraries in your source tree. </p>
<p>
<pre>
svn co http://svn.distriqt.com/public/trunk/gmaps/trunk/ distriqt-gmaps
svn co http://gmaps-utility-library-flash.googlecode.com/svn/trunk/ gmaps-utility-library-flash-read-only
</pre>
</p>
<p>You'll end up with a src directory in both of these checkouts that you need to add to your source path for your projects.</p>
<p>Here are the current packages (v1.2) <a href='http://labs.distriqt.com/wordpress/wp-content/uploads/2011/06/distriqt-gmaps-kmlloader.zip'>distriqt-gmaps-kmlloader-v1.2</a> and <a href='http://labs.distriqt.com/wordpress/wp-content/uploads/2011/06/google-utility-library-flash.zip'>google-utility-library-flash</a>.</p>
<p>Let me know if you find it useful!</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="tall" count="1" href="http://labs.distriqt.com/post/577"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://labs.distriqt.com/post/577/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Streaming Webcam To a Ubuntu Red5 Server</title>
		<link>http://labs.distriqt.com/post/493</link>
		<comments>http://labs.distriqt.com/post/493#comments</comments>
		<pubDate>Thu, 24 Mar 2011 00:05:44 +0000</pubDate>
		<dc:creator>Michael Archbold</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[red5]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://labs.distriqt.com/?p=493</guid>
		<description><![CDATA[For an upcoming project we needed to stream content from the user's webcam to be recorded on the server. In theory this sounded like a basic operation, having used FMS to this end before, but actually installing and setting up the Red5 server proved to be a little tricky. So I just wanted to outline [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Flabs.distriqt.com%2Fpost%2F493"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Flabs.distriqt.com%2Fpost%2F493&amp;source=distriqt&amp;style=normal&amp;service=bit.ly&amp;service_api=R_d2c0f1a5509cd228ab0be545d628ad7a&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>For an upcoming project we needed to stream content from the user's webcam to be recorded on the server. In theory this sounded like a basic operation, having used FMS to this end before, but actually installing and setting up the Red5 server proved to be a little tricky. So I just wanted to outline the process I went through to get a Red5 Server running on ubuntu and how to setup your first recording stream.</p>
<p><img src="http://labs.distriqt.com/wordpress/wp-content/uploads/2011/03/Red5.png" alt="" title="Red5" width="425" height="169" class="aligncenter size-full wp-image-494" /></p>
<blockquote><p><a href="http://www.red5.org">Red5</a> is a powerful Java based video streaming and multi-user solution for the Flash Player. Red5 includes support for the latest multi-user API’s including NetConnection, NetStream and SharedObject’s while providing a powerful RTMP / Servlet implementation. It is basically an open source Flash Media Server. </p></blockquote>
<p>We're going to go through two major steps here, firstly installing Red5 on Ubuntu and then building a simple application to record the webcam.<br />
<span id="more-493"></span></p>
<p><strong>Installing Red5</strong></p>
<p>For this installation we're going to use a stock Ubuntu Server installation (8.04 Hardy Heron). We installed LAMP as well for the project but it's not required for Red5. Firstly we need to install a few dependencies including the Java runtime environment and the Java development kit (and yes these are terminal commands so get it up and running):</p>
<p><code>sudo apt-get install java-package sun-java6-jdk sun-java6-jre<br />
sudo apt-get install subversion ant</code></p>
<p>Next we need to grab the code base for Red5. We tried the trunk version first but had some issues with it (as you'd expect from a HEAD revision) so ended up using v0.9.1. You can try other versions of the server by browsing the <a href="http://red5.googlecode.com/svn/java/server/tags/">repository</a> and replacing the reference in the svn checkout below:</p>
<p><code>svn co http://red5.googlecode.com/svn/java/server/tags/0_9_1/ ~/red5</code></p>
<p>Now we build using Ant:</p>
<p><code>export JAVA_HOME=/usr/lib/jvm/java-6-sun<br />
export ANT_HOME=/usr/share/ant/<br />
cd ~/red5<br />
/usr/share/ant/bin/ant</code></p>
<p>Make sure there were no errors during the build. If there were consult the red5 wiki for help. Install:</p>
<p><code>sudo mkdir /usr/share/red5<br />
sudo cp -R ~/red5/dist/* /usr/share/red5/.<br />
sudo chmod 755 /usr/share/red5/red5.sh</code></p>
<p>Start the Red5 server:</p>
<p><code>export RED5_HOME=/usr/share/red5<br />
/usr/share/red5/red5.sh</code></p>
<p>Next we need to create the startup script. This script will allow you to get the server starting on reboot etc. Put the following text into the file <code>/etc/init.d/red5</code> and make the file executable <code>sudo chmod 755 /etc/init.d/red5</code>. </p>
<pre class="bash"><span style="color: #808080; font-style: italic;">#!/bin/sh</span>
<span style="color: #808080; font-style: italic;"># init script <span style="color: #000000; font-weight: bold;">for</span> Red5</span>
<span style="color: #808080; font-style: italic;"># /etc/init.d/red5</span>
&nbsp;
<span style="color: #007800;">RED5_USER=</span>root
<span style="color: #007800;">RED5_HOME=</span>/usr/share/red5
<span style="color: #007800;">RED5_PROG=</span>red5
&nbsp;
<span style="color: #7a0874; font-weight: bold;">test</span> -x <span style="color: #007800;">$RED5_HOME</span>/<span style="color: #007800;">$RED5_PROG</span>.<span style="color: #c20cb9; font-weight: bold;">sh</span> || <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">5</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
     start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
         <span style="color: #7a0874; font-weight: bold;">echo</span> -n <span style="color: #ff0000;">&quot;Starting Red5&quot;</span>
         <span style="color: #7a0874; font-weight: bold;">echo</span> -n <span style="color: #ff0000;">&quot; &quot;</span>
         <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$RED5_HOME</span>
         <span style="color: #c20cb9; font-weight: bold;">su</span> -s /bin/bash -c <span style="color: #ff0000;">&quot;$RED5_HOME/$RED5_PROG.sh &amp;&quot;</span> <span style="color: #007800;">$RED5_USER</span>
         <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">2</span>
         ;;
     stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
         <span style="color: #7a0874; font-weight: bold;">echo</span> -n <span style="color: #ff0000;">&quot;Shutting down Red5&quot;</span>
         <span style="color: #7a0874; font-weight: bold;">echo</span> -n <span style="color: #ff0000;">&quot; &quot;</span>
         <span style="color: #c20cb9; font-weight: bold;">su</span> -s /bin/bash -c <span style="color: #ff0000;">&quot;killall -q -u $RED5_USER java&quot;</span> <span style="color: #007800;">$RED5_USER</span>
         <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">2</span>
         ;;
     restart<span style="color: #7a0874; font-weight: bold;">&#41;</span>
         $<span style="color: #000000;">0</span> stop
         $<span style="color: #000000;">0</span> start
         ;;
<span style="color: #000000; font-weight: bold;">esac</span></pre>
<p><br/><br />
Now you can start/stop/restart from the command line by using:<br />
<code>sudo /etc/init.d/red5 [start/stop/restart]</code></p>
<p>Lastly once you've got the server running, you can browse to the test page on your server <a href="http://localhost:5080">http://localhost:5080</a> and you should see:</p>
<p><img src="http://labs.distriqt.com/wordpress/wp-content/uploads/2011/03/red5-test-screen.png" alt="" title="red5-test-screen" width="580" height="390" class="aligncenter size-full wp-image-502" /></p>
<p>If you can't see this it and you've confirmed the Red5 server is running it could be a firewall issue. You may need to alter the IPTables on your machine but that's not going to be covered here.</p>
<p>Lastly we need to install the actual streaming application on our Red5 Server. Navigate to <a href="http://localhost:5080/installer/">http://localhost:5080/installer/</a>, select the oflaDemo and click Install.<br />
To test it installed correctly, navigate to <a href="http://localhost:5080/demos/ofla_demo.html">http://localhost:5080/demos/ofla_demo.html</a> (correct the server name in the top right) and hit connect. You should see a list of available videos and a green light in the top right.</p>
<p>Congratulations you're all up and running with a Red5 Server!</p>
<hr/>
<br/><br />
<strong>Sample Application</strong></p>
<p>The following class shows a very simple example of starting a streaming feed to the server and then streaming the same data back from the server into a Video object on the stage.</p>
<p>The fundamentals are very simple:</p>
<ul>
<li>Create a NetConnection object and connect to the server</li>
<li>Create a NetStream when the connection succeeds and publish the camera feed to the stream as a "record" type</li>
</ul>
<pre class="actionscript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #0066CC;">NetConnection</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #0066CC;">NetStream</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">NetStatusEvent</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">media</span>.<span style="color: #0066CC;">Camera</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">media</span>.<span style="color: #0066CC;">Video</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Red5Experiment <span style="color: #0066CC;">extends</span> Sprite</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #808080; font-style: italic;">//</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #808080; font-style: italic;">//	Constants</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const RED5_URL	: <span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;rtmp://SERVERNAME/oflaDemo/test/&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #808080; font-style: italic;">//</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #808080; font-style: italic;">//	Variables</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _netConnection	: <span style="color: #0066CC;">NetConnection</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _netStream		: <span style="color: #0066CC;">NetStream</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _recvStream		: <span style="color: #0066CC;">NetStream</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">_url</span>		: <span style="color: #0066CC;">String</span> = RED5_URL;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _filename		: <span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;test-red5&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _video		: <span style="color: #0066CC;">Video</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Red5Experiment<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			_netConnection = <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>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			_netConnection.<span style="color: #0066CC;">connect</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">_url</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			_netConnection.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> NetStatusEvent.<span style="color: #006600;">NET_STATUS</span>, netStatusHandler, <span style="color: #000000; font-weight: bold;">false</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			_video = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Video</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			addChild<span style="color: #66cc66;">&#40;</span> _video <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #808080; font-style: italic;">////////////////////////////////////////////////////////</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #808080; font-style: italic;">//	FUNCTIONALITY</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #808080; font-style: italic;">//</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #808080; font-style: italic;">//</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #808080; font-style: italic;">//	Setup the camera</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> cam:<span style="color: #0066CC;">Camera</span> = <span style="color: #0066CC;">Camera</span>.<span style="color: #006600;">getCamera</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			cam.<span style="color: #006600;">setLoopback</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			cam.<span style="color: #0066CC;">setMode</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">176</span>,<span style="color: #cc66cc;">144</span>,<span style="color: #cc66cc;">15</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			cam.<span style="color: #006600;">setKeyFrameInterval</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			cam.<span style="color: #0066CC;">setQuality</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">70</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #808080; font-style: italic;">//</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #808080; font-style: italic;">//	Start publishing the video stream</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			_netStream = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">NetStream</span><span style="color: #66cc66;">&#40;</span>_netConnection<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			_netStream.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> NetStatusEvent.<span style="color: #006600;">NET_STATUS</span>, netStatusHandler, <span style="color: #000000; font-weight: bold;">false</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			_netStream.<span style="color: #006600;">attachCamera</span><span style="color: #66cc66;">&#40;</span> cam <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			_netStream.<span style="color: #006600;">publish</span><span style="color: #66cc66;">&#40;</span>_filename, <span style="color: #ff0000;">&quot;record&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #808080; font-style: italic;">//</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #808080; font-style: italic;">//	Grab live stream back from server</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			_recvStream = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">NetStream</span><span style="color: #66cc66;">&#40;</span>_netConnection<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			_recvStream.<span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span>_filename<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			_video.<span style="color: #006600;">attachNetStream</span><span style="color: #66cc66;">&#40;</span>_recvStream<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #808080; font-style: italic;">//</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #808080; font-style: italic;">//	Alternatively, Use the local camera feed</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//			_video.attachCamera(cam);</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #808080; font-style: italic;">////////////////////////////////////////////////////////</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #808080; font-style: italic;">//	EVENT HANDLERS</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #808080; font-style: italic;">//</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> netStatusHandler<span style="color: #66cc66;">&#40;</span> event:NetStatusEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;Red5Experiment::netStatusHandler():&quot;</span>+event.<span style="color: #006600;">info</span>.<span style="color: #006600;">code</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #b1b100;">switch</span> <span style="color: #66cc66;">&#40;</span> event.<span style="color: #006600;">info</span>.<span style="color: #006600;">code</span> <span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				<span style="color: #b1b100;">case</span> <span style="color: #ff0000;">&quot;NetConnection.Connect.Success&quot;</span>:</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">					<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">					<span style="color: #b1b100;">break</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<p>The files are recorded to a directory within the webapps folder on your server. If you've followed the paths above you'll find the file <code>/usr/share/red5/webapps/oflaDemo/streams/test/test-red5.flv</code> on your server.</p>
<p>You now should have a complete streaming / recording media setup. All running off an open source server! </p>
<hr/>
<p>EDIT: I've created a zip of the sample application files: <a href='http://labs.distriqt.com/wordpress/wp-content/uploads/2011/05/red5_sampleapplication.zip'>red5_sampleapplication</a></p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="tall" count="1" href="http://labs.distriqt.com/post/493"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://labs.distriqt.com/post/493/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>KML Interactions</title>
		<link>http://labs.distriqt.com/post/421</link>
		<comments>http://labs.distriqt.com/post/421#comments</comments>
		<pubDate>Mon, 04 Oct 2010 11:49:09 +0000</pubDate>
		<dc:creator>Michael Archbold</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[google-maps]]></category>
		<category><![CDATA[interaction]]></category>
		<category><![CDATA[kml]]></category>

		<guid isPermaLink="false">http://labs.distriqt.com/?p=421</guid>
		<description><![CDATA[I've had a few requests asking about how to interact with the KML once you've loaded it onto the map. It's really quite an easy step once you've got the KML on there but I'll show you how in this simple example. Firstly if you haven't read the Simple KML Loader post then head over [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Flabs.distriqt.com%2Fpost%2F421"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Flabs.distriqt.com%2Fpost%2F421&amp;source=distriqt&amp;style=normal&amp;service=bit.ly&amp;service_api=R_d2c0f1a5509cd228ab0be545d628ad7a&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I've had a few requests asking about how to interact with the KML once you've loaded it onto the map. It's really quite an easy step once you've got the KML on there but I'll show you how in this simple example.</p>
<p><a href="http://labs.distriqt.com/examples/kmlloader/index.html" rel="shadowbox"><img src="http://labs.distriqt.com/wordpress/wp-content/uploads/2010/10/kml-interaction-example-580x332.png" alt="KML Interaction Example" title="KML Interaction Example" width="580" height="332" class="aligncenter size-medium wp-image-422" /></a><br />
<span id="more-421"></span><br />
Firstly if you haven't read the <a href="http://labs.distriqt.com/post/251">Simple KML Loader</a> post then head over there first. It explains how to get that KML file loaded and displayed on your map.</p>
<p>The objective of this simple example is to show an info window popup when we rollover one of the objects in the kml, showing the name of the kml object in the window.</p>
<p>The code for this example is in our svn:</p>
<p><code>svn co http://svn.distriqt.com/public/trunk/gmaps/examples/kmlloader/</code></p>
<p>Make sure you have our SimpleKmlLoader library in your project.</p>
<p>To create the loader, load the kml and have it added to your map:</p>
<pre class="actionscript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> _loader:SimpleKmlLoader = <span style="color: #000000; font-weight: bold;">new</span> SimpleKmlLoader<span style="color: #66cc66;">&#40;</span> _map, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">_loader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">COMPLETE</span>, loader_completeHandler <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">_loader.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span> _file <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li></ol></pre>
<p>Now on the complete handler you can add the interactions:</p>
<pre class="actionscript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> loader_completeHandler<span style="color: #66cc66;">&#40;</span> _event:Event <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #808080; font-style: italic;">// At this point generally this objects array</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #808080; font-style: italic;">//   will simply be the base object of the KML</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	addInteraction<span style="color: #66cc66;">&#40;</span> _loader.<span style="color: #006600;">objects</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Add interaction to every object in the array</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;*/</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> addInteraction<span style="color: #66cc66;">&#40;</span> _objects:<span style="color: #0066CC;">Array</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #b1b100;">for</span> each <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> _object:KmlDisplayObject <span style="color: #b1b100;">in</span> _objects<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		_object.<span style="color: #006600;">interactive</span> = <span style="color: #000000; font-weight: bold;">true</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		_object.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MapMouseEvent.<span style="color: #006600;">ROLL_OVER</span>, object_rollOverHandler, <span style="color: #000000; font-weight: bold;">false</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		_object.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MapMouseEvent.<span style="color: #006600;">ROLL_OUT</span>, object_rollOutHandler, <span style="color: #000000; font-weight: bold;">false</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #808080; font-style: italic;">// Process any children</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		addInteraction<span style="color: #66cc66;">&#40;</span> _object.<span style="color: #006600;">children</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> object_rollOverHandler<span style="color: #66cc66;">&#40;</span> _event:MapMouseEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #808080; font-style: italic;">// show an info panel...</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #000000; font-weight: bold;">var</span> _object:KmlDisplayObject = KmlDisplayObject<span style="color: #66cc66;">&#40;</span>_event.<span style="color: #006600;">currentTarget</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	_map.<span style="color: #006600;">openInfoWindow</span><span style="color: #66cc66;">&#40;</span> _object.<span style="color: #006600;">latLng</span>, <span style="color: #000000; font-weight: bold;">new</span> InfoWindowOptions<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>content:_object.<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> object_rollOutHandler<span style="color: #66cc66;">&#40;</span> _event:MapMouseEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	_map.<span style="color: #006600;">closeInfoWindow</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<p>Now when you run with this code you should see the name of the kml object appear in the info window when you rollover the object. This is of course a very simple example, and much more can be done with this, but it is a good point to introduce the concept of interactions.</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="tall" count="1" href="http://labs.distriqt.com/post/421"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://labs.distriqt.com/post/421/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Simple KML Loader Revisited</title>
		<link>http://labs.distriqt.com/post/251</link>
		<comments>http://labs.distriqt.com/post/251#comments</comments>
		<pubDate>Mon, 02 Aug 2010 12:40:02 +0000</pubDate>
		<dc:creator>Michael Archbold</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[google-maps]]></category>
		<category><![CDATA[kml]]></category>

		<guid isPermaLink="false">http://labs.distriqt.com/?p=251</guid>
		<description><![CDATA[Recently we've been using some of our own tools in other projects and found some room for improvement on the KML Loader we developed. In particular we wanted a simple class that could handle all the processing from the loader, adding the resulting overlays to the google map. Also we needed it to load in [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Flabs.distriqt.com%2Fpost%2F251"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Flabs.distriqt.com%2Fpost%2F251&amp;source=distriqt&amp;style=normal&amp;service=bit.ly&amp;service_api=R_d2c0f1a5509cd228ab0be545d628ad7a&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Recently we've been using some of our own tools in other projects and found some room for improvement on the KML Loader we developed. In particular we wanted a simple class that could handle all the processing from the loader, adding the resulting overlays to the google map. Also we needed it to load in some of the styles, such as colours and line types. </p>
<p><a href="http://labs.distriqt.com/wordpress/wp-content/uploads/2010/08/simplekmlloader-example-screenshot1.jpg" rel="shadowbox[sbpost-251];player=img;"><img src="http://labs.distriqt.com/wordpress/wp-content/uploads/2010/08/simplekmlloader-example-screenshot1-580x294.jpg" alt="Example Kml Loader ScreenShot" title="Example Kml Loader ScreenShot" width="580" height="294" class="aligncenter size-medium wp-image-316" /></a></p>
<p>So we've expanded our <a href="http://labs.distriqt.com/post/164"><code>KmlLoader</code></a> class and provided a few additional utility classes.<br />
<span id="more-251"></span><br />
Before we get into it, to get the latest version, just checkout from our public svn:</p>
<p><code>svn co http://svn.distriqt.com/public/trunk/gmaps</code></p>
<p>The most useful is the <code>SimpleKmlLoader</code> class. This simplifies the loading and display of a kml file to a single line of code.</p>
<pre class="actionscript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #000000; font-weight: bold;">new</span> SimpleKmlLoader<span style="color: #66cc66;">&#40;</span> _map, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span> _file <span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>Generally you'll probably want to do something more with the kml than just display it, but this is handy for those quick display situations. You'll probably more want to do something like this, adding an event listener for when the file is loaded:</p>
<pre class="actionscript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> _loader:SimpleKmlLoader = <span style="color: #000000; font-weight: bold;">new</span> SimpleKmlLoader<span style="color: #66cc66;">&#40;</span> _map, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">_loader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">COMPLETE</span>, loader_completeHandler <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">_loader.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span> _file <span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>The second parameter provided to the constructor is an option to automatically add the objects to the map when the load is complete, so you no longer have to worry about adding the features to the map. </p>
<p>Once the loader has completed you'll have access to all the objects loaded from within the file. Each of the Kml Objects is represented by the <code>KmlDisplayObject</code> class, which has automatically created the appropriate type of map feature to add when required. </p>
<p>The important properties are <code>SimpleKmlLoader.objects</code> which is an array of <code>KmlDisplayObject</code> and then <code>KmlDisplayObject.children</code> contains all the children of that object (again an array of <code>KmlDisplayObject</code>).</p>
<pre class="actionscript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> com.<span style="color: #006600;">distriqt</span>.<span style="color: #006600;">gmaps</span>.<span style="color: #006600;">kml</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">*</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Iterates over the objects and traces out the name of</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;*   each and recurses into the children of each object</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* @param _objects	An array of KmlDisplayObjects</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* @param _prefix	A string to prefix to the output trace</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;*/</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> traceObjects<span style="color: #66cc66;">&#40;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    _objects:<span style="color: #0066CC;">Array</span> <span style="color: #808080; font-style: italic;">/* of KmlDisplayObject */</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    _prefix:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #b1b100;">for</span> each <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> _object:KmlDisplayObject <span style="color: #b1b100;">in</span> _objects<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> _prefix+<span style="color: #ff0000;">&quot; &quot;</span>+_object.<span style="color: #0066CC;">name</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		traceObjects<span style="color: #66cc66;">&#40;</span> _object.<span style="color: #006600;">children</span>, _prefix + <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> loader_completeHandler<span style="color: #66cc66;">&#40;</span> _event:Event <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	traceObjects<span style="color: #66cc66;">&#40;</span> _loader.<span style="color: #006600;">objects</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li></ol></pre>
<p>The trace output from the function above would look something like the below:</p>
<pre>
 districts for BSI
	 kangaroo ground
	 kinglake west
	 kinglake
	 ...
</pre>
<p>There is an example usage of the class in the svn, <code>gmaps/examples/kmlloader/</code>. It will load the kml file shown in the image above.</p>
<p>We've also added some Kml editing and saving tools into the svn which we'll leave those for the subject of another post but feel free to check out the <a href="http://svn.distriqt.com/public/trunk/gmaps/">code</a>.</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="tall" count="1" href="http://labs.distriqt.com/post/251"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://labs.distriqt.com/post/251/feed</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>Simple KML Loader</title>
		<link>http://labs.distriqt.com/post/164</link>
		<comments>http://labs.distriqt.com/post/164#comments</comments>
		<pubDate>Tue, 20 Oct 2009 07:56:56 +0000</pubDate>
		<dc:creator>Michael Archbold</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[abc]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[google-maps]]></category>

		<guid isPermaLink="false">http://labs.distriqt.com/?p=164</guid>
		<description><![CDATA[Lately we have been playing around a fair bit with some google flash maps and have been amazed by the power and simplicity of the API. We used it heavily in the ABC Black Saturday site using custom markers with images and even a scrolling grid. We were faced with another challenge of being able [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Flabs.distriqt.com%2Fpost%2F164"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Flabs.distriqt.com%2Fpost%2F164&amp;source=distriqt&amp;style=normal&amp;service=bit.ly&amp;service_api=R_d2c0f1a5509cd228ab0be545d628ad7a&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Lately we have been playing around a fair bit with some google flash maps and have been amazed by the power and simplicity of the API. We used it heavily in the ABC Black Saturday site using custom markers with images and even a scrolling grid.</p>
<p>We were faced with another challenge of being able to mark out areas (districts) within Victoria that represented the most affected regions. These regions were sometimes complex and we needed to be able to update them simply and quickly as the need arose. The regions weren't to be displayed directly but used for two major items.  Firstly to focus the map on a particular region, by moving the view to the region contained by these districts, and secondly, to assign events/markers to a district by calculating if they were contained within the bounds of the district lines.</p>
<p>The solution ended up being ridiculously simple. We created a shared map on google maps, with shapes defining the districts. We then could export from this online map to kml by grabbing the view in Google Earth link and changing the output parameter from nl to kml. This gave us the map of the districts in a nice kml format.</p>
<p><a href="http://labs.distriqt.com/wordpress/wp-content/uploads/2009/10/abc-district-google-map.png" rel="shadowbox[sbpost-164];player=img;"><img src="http://labs.distriqt.com/wordpress/wp-content/uploads/2009/10/abc-district-google-map-150x150.png" alt="abc-district-google-map" title="abc-district-google-map" width="150" height="150" class="aligncenter size-thumbnail wp-image-168" /></a></p>
<p>Once we had the map in kml we needed to load in the objects and create overlays for google maps. Surprisingly there wasn't a simple "load kml" function in google maps, but there are some nice kml parsing utilities in the google map extras library. So we created a kml loader class that loads the kml file, extracts the objects and creates overlays for placement on a google map. Hopefully it can be helpful to others, check it out from the following:</p>
<p><code>svn co http://svn.distriqt.com/public/trunk/gmaps<br />
</code></p>
<p>Usage:</p>
<p>Firstly create the loader and start the load of your kml file. You'll need to add a listener to the COMPLETE event to process the code on completion.</p>
<pre class="actionscript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> com.<span style="color: #006600;">distriqt</span>.<span style="color: #006600;">gmaps</span>.<span style="color: #006600;">kml</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">*</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> kmlLoader:KmlLoader = <span style="color: #000000; font-weight: bold;">new</span> KmlLoader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">kmlLoader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">COMPLETE</span>, kmlLoader_completeHandler <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">kmlLoader.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span>  <span style="color: #ff0000;">&quot;your-kml-file-location.kml&quot;</span> <span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>Once the loading is complete you'll have to re-curse through the object list in the loader, adding the objects to your map. Note the "map" variable in the below should be your google map instance.</p>
<pre class="actionscript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> kmlLoader_completeHandler<span style="color: #66cc66;">&#40;</span> _event:Event <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #b1b100;">for</span> each <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> _object:KmlDisplayObject <span style="color: #b1b100;">in</span> KmlLoader<span style="color: #66cc66;">&#40;</span>_event.<span style="color: #006600;">currentTarget</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">objects</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		addObject<span style="color: #66cc66;">&#40;</span> _object <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> addObject<span style="color: #66cc66;">&#40;</span> _object:KmlDisplayObject <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #808080; font-style: italic;">// It may just be a container with child elements</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #808080; font-style: italic;">//    so check if there is an overlay</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>_object.<span style="color: #006600;">overlay</span> != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #808080; font-style: italic;">// Here you can add the kml object to your map</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		map.<span style="color: #006600;">addOverlay</span><span style="color: #66cc66;">&#40;</span> _object.<span style="color: #006600;">overlay</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #808080; font-style: italic;">// Add the children</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #b1b100;">for</span> each <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> _child:KmlDisplayObject <span style="color: #b1b100;">in</span> _object.<span style="color: #006600;">children</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		addObject<span style="color: #66cc66;">&#40;</span> _child <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<p>Let us know if you find it useful.</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="tall" count="1" href="http://labs.distriqt.com/post/164"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://labs.distriqt.com/post/164/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

