<?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>NTG Web Site</title>
	<atom:link href="http://www.newyyz.com/ntgsite/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.newyyz.com/ntgsite</link>
	<description>Application Development - HTML5, Android, PlayBook, Ipad, Video and Rich Internet Application Training</description>
	<lastBuildDate>Wed, 16 May 2012 18:18:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>BlackBerry Hackathons &#8211; Come out and Play(Book)!</title>
		<link>http://www.newyyz.com/ntgsite/2012/05/blackberry-hackathons-come-out-and-playbook/</link>
		<comments>http://www.newyyz.com/ntgsite/2012/05/blackberry-hackathons-come-out-and-playbook/#comments</comments>
		<pubDate>Wed, 16 May 2012 14:28:12 +0000</pubDate>
		<dc:creator>oliverm</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[RIM]]></category>
		<category><![CDATA[WebWorks]]></category>

		<guid isPermaLink="false">http://www.newyyz.com/ntgsite/?p=3546</guid>
		<description><![CDATA[I&#8217;m currently in Bogotá, Colombia taking part in my third Hackathon on behalf of RIM. These hackathons are two-day events where local developers get the opportunity to interact directly with experts in PlayBook development. They also get a free PlayBook just for showing up! We typically have a team of three experts covering AIR, HTML5/WebWorks [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently in Bogotá, Colombia taking part in my third Hackathon on behalf of RIM. These hackathons are two-day events where local developers get the opportunity to interact directly with experts in PlayBook development. They also get a free PlayBook just for showing up!</p>
<p>We typically have a team of three experts covering AIR, HTML5/WebWorks and Native development. Most of the events have been focused on game development, but I&#8217;ve also done one centred around business apps using WebWorks.</p>
<p>Developers, either in teams or individually, work some long hours over the two day period. At the end of the second day, their apps are judged and winners awarded additional prizes. Nothing like a bit of competition to bring out the best in a dev team!</p>
<p>And with BB10 on the horizon, there&#8217;s a lot of anticipation from developers. Keep your eyes open for an event coming to your city this summer. Hope to see you there!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.newyyz.com%2Fntgsite%2F2012%2F05%2Fblackberry-hackathons-come-out-and-playbook%2F&amp;title=BlackBerry%20Hackathons%20%26%238211%3B%20Come%20out%20and%20Play%28Book%29%21"><img src="http://www.newyyz.com/ntgsite/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.newyyz.com/ntgsite/2012/05/blackberry-hackathons-come-out-and-playbook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android: Using the MediaPlayer for online streams</title>
		<link>http://www.newyyz.com/ntgsite/2012/05/android-using-the-mediaplayer-for-online-streams/</link>
		<comments>http://www.newyyz.com/ntgsite/2012/05/android-using-the-mediaplayer-for-online-streams/#comments</comments>
		<pubDate>Thu, 10 May 2012 21:11:24 +0000</pubDate>
		<dc:creator>alaint</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[MediaPlayer]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[mobile apps]]></category>
		<category><![CDATA[mobile development]]></category>

		<guid isPermaLink="false">http://www.newyyz.com/ntgsite/?p=3506</guid>
		<description><![CDATA[By Alain Thibodeau – Consultant We’ve looked at ways of making use of the SoundPool class for smaller sounds like sound effects in a previous post. But, what about streaming audio from a server? Like an online radio station. This can be easily done using the MediaPlayer class. Below is a quick and simple example [...]]]></description>
			<content:encoded><![CDATA[<p><em>By Alain Thibodeau – Consultant</em></p>
<p>We’ve looked at ways of making use of the SoundPool class for smaller sounds like sound effects in a previous post. But, what about streaming audio from a server? Like an online radio station. This can be easily done using the MediaPlayer class.</p>
<p>Below is a quick and simple example using the MediaPlayer for streaming online content.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:1200px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.newyyz</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.Activity</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.media.AudioManager</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.media.MediaPlayer</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View.OnClickListener</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.Button</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.EditText</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.TextView</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> StreamingAudioPlayerActivity <span style="color: #000000; font-weight: bold;">extends</span> Activity <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abutton+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Button</span></a> playButton<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abutton+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Button</span></a> stopButton<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> EditText urlEditText<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> TextView statusText<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> MediaPlayer mediaPlayer<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onCreate<span style="color: #009900;">&#40;</span>Bundle savedInstanceState<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span>savedInstanceState<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; setContentView<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">main</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; initView<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; initMediaPlayer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> initView<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; urlEditText <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>EditText<span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">UrlEditText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; urlEditText.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://playradio.podzone.org:9090/Play96.mp3&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; statusText <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TextView<span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">status</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; playButton <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abutton+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Button</span></a><span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">playButton</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; playButton.<span style="color: #006633;">setOnClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> OnClickListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onClick<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">View</span></a> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; playStream<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; stopButton <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abutton+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Button</span></a><span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">stopButton</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; stopButton.<span style="color: #006633;">setOnClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> OnClickListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onClick<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">View</span></a> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stopStream<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> initMediaPlayer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; mediaPlayer <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MediaPlayer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; mediaPlayer.<span style="color: #006633;">setAudioStreamType</span><span style="color: #009900;">&#40;</span>AudioManager.<span style="color: #006633;">STREAM_MUSIC</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; mediaPlayer.<span style="color: #006633;">setOnPreparedListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> MediaPlayer.<span style="color: #006633;">OnPreparedListener</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onPrepared<span style="color: #009900;">&#40;</span>MediaPlayer mp<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mediaPlayer.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; statusText.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Playing...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> playStream<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; statusText.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Loading...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; playButton.<span style="color: #006633;">setVisibility</span><span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">View</span></a>.<span style="color: #006633;">GONE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; stopButton.<span style="color: #006633;">setVisibility</span><span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">View</span></a>.<span style="color: #006633;">VISIBLE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mediaPlayer.<span style="color: #006633;">setDataSource</span><span style="color: #009900;">&#40;</span>urlEditText.<span style="color: #006633;">getText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mediaPlayer.<span style="color: #006633;">prepareAsync</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> stopStream<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; playButton.<span style="color: #006633;">setVisibility</span><span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">View</span></a>.<span style="color: #006633;">VISIBLE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; stopButton.<span style="color: #006633;">setVisibility</span><span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">View</span></a>.<span style="color: #006633;">GONE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; statusText.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; mediaPlayer.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; mediaPlayer.<span style="color: #006633;">reset</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> onDestroy<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onDestroy</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; mediaPlayer.<span style="color: #006633;">release</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>As usual in our onCreate() method we setup the view. In this case we setup an EditText, TextView and two button controls. One button is for playing and the other is for stopping the stream. The EditText control is for our stream’s URL, and the TextView control is for giving the user some feedback about what is going on.</p>
<p>The next step is to create our MediaPlayer instance which we do in the initMediaPlayer() method. We also set the audio stream type and most importantly a listener for when the stream has finished preparing. In this example we are using the asynchronous version of the MediaPlayer’s prepare method. The reason we are preparing the MediaPlayer asynchronously is that we are accessing a stream on the Internet. Because of this, preparing may take some time. If we were to use the synchronous prepare method, it would lock the application until the player is ready.</p>
<p>Upon hitting play, we update the buttons and the status. At this point we are ready to set the datasource and prepare our MediaPlayer instance. Once the MediaPlayer is prepared, we play the stream in the OnPreparedListener();</p>
<p>Stopping the stream is done in the stopStream() method. We simply swap our buttons and stop the MediaPlayer. Resetting the MediaPlayer will put the player in its uninitialized state so we can set a new (or the same) data source and re-prepare.</p>
<p>Should the user exit the app, we will want to clean up. This is handled in the override of the onDestroy() method where we simply release the mediaPlayer. Based on what your needs are, you will handle the MediaPlayer for the various activity’s lifecycle phases.</p>
<p>So there we have it, a very simple media player for handling online streams. This could be the start of a very compelling Android application that can handle online streams, local files and video.</p>
<p><a href="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/05/mediaplayer.png"><img class="alignnone size-full wp-image-3515" title="mediaplayer" src="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/05/mediaplayer.png" alt="" width="250" height="398" /></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.newyyz.com%2Fntgsite%2F2012%2F05%2Fandroid-using-the-mediaplayer-for-online-streams%2F&amp;title=Android%3A%20Using%20the%20MediaPlayer%20for%20online%20streams"><img src="http://www.newyyz.com/ntgsite/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.newyyz.com/ntgsite/2012/05/android-using-the-mediaplayer-for-online-streams/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android: Using the SoundPool class</title>
		<link>http://www.newyyz.com/ntgsite/2012/05/android-using-the-soundpool-class/</link>
		<comments>http://www.newyyz.com/ntgsite/2012/05/android-using-the-soundpool-class/#comments</comments>
		<pubDate>Thu, 10 May 2012 21:09:51 +0000</pubDate>
		<dc:creator>alaint</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[Audio]]></category>
		<category><![CDATA[mobile apps]]></category>
		<category><![CDATA[SoundPool]]></category>

		<guid isPermaLink="false">http://www.newyyz.com/ntgsite/?p=3469</guid>
		<description><![CDATA[By Alain Thibodeau – Consultant There are times when you want to play a short sound in your application warning the user that something has happened, or just to add sound effects. Using the MediaPlayer is a good way of playing a sound, but it is system taxing if you are using more than one [...]]]></description>
			<content:encoded><![CDATA[<p><em>By Alain Thibodeau – Consultant</em></p>
<p>There are times when you want to play a short sound in your application warning the user that something has happened, or just to add sound effects. Using the MediaPlayer is a good way of playing a sound, but it is system taxing if you are using more than one sound, and playing them at the same time. The SoundPool class will allow you to manage and play multiple <em>short</em> sounds.</p>
<p>Below is a simple example of using the SoundPool class.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:1100px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.newyyz</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.Activity</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.media.AudioManager</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.media.SoundPool</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View.OnClickListener</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.Button</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SoundPoolActivity <span style="color: #000000; font-weight: bold;">extends</span> Activity <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; SoundPool soundPool<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> ringSound <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> bangSound <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abutton+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Button</span></a> btnPlayRing<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abutton+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Button</span></a> btnPlayBang<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abutton+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Button</span></a> btnPlayAll<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onCreate<span style="color: #009900;">&#40;</span>Bundle savedInstanceState<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span>savedInstanceState<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; setContentView<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">main</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; btnPlayRing <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abutton+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Button</span></a><span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">btnRing</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; btnPlayBang <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abutton+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Button</span></a><span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">btnBang</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; btnPlayAll <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abutton+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Button</span></a><span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">btnAll</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; setVolumeControlStream<span style="color: #009900;">&#40;</span>AudioManager.<span style="color: #006633;">STREAM_MUSIC</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; soundPool <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SoundPool<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span>, AudioManager.<span style="color: #006633;">STREAM_MUSIC</span>, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; bangSound <span style="color: #339933;">=</span> soundPool.<span style="color: #006633;">load</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, R.<span style="color: #006633;">raw</span>.<span style="color: #006633;">hit</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ringSound <span style="color: #339933;">=</span> soundPool.<span style="color: #006633;">load</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, R.<span style="color: #006633;">raw</span>.<span style="color: #006633;">ring</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; btnPlayRing.<span style="color: #006633;">setOnClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> OnClickListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onClick<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">View</span></a> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; soundPool.<span style="color: #006633;">play</span><span style="color: #009900;">&#40;</span>ringSound, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; btnPlayBang.<span style="color: #006633;">setOnClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> OnClickListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onClick<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">View</span></a> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; soundPool.<span style="color: #006633;">play</span><span style="color: #009900;">&#40;</span>bangSound, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; btnPlayAll.<span style="color: #006633;">setOnClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> OnClickListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onClick<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">View</span></a> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; soundPool.<span style="color: #006633;">play</span><span style="color: #009900;">&#40;</span>bangSound, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; soundPool.<span style="color: #006633;">play</span><span style="color: #009900;">&#40;</span>ringSound, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>We start off on line 22 in the onCreate() method setting the content to our layout resource and preparing three buttons. These buttons will play our sound effects. The first one will play the <em>ring </em>sound, the second will play the <em>bang </em>sound and the third one will play both sounds at the same time.</p>
<p>Next we set the volume controls to the music stream on line 31. Then we create a soundpool and configure it to handle 2 concurrent streams. Set this value to what your needs are, usually around 15-20 if you are creating a game.</p>
<p>Once the soundPool is created,  we can load our sound files, the soundpool’s load method will return a handle so we can reference the sounds when we need them.</p>
<p>Finally, we have our listeners on each button that call the sounpool’s play method. The first argument is the sound&#8217;s handle that we received from the load method. The second and third arguments are the left and right volume that range between 0 and 1. The next one is the priority. Following the priority is the loop count with -1 for looping forever. The last argument is the playback rate, which increases or decreases the speed of the audio.</p>
<p>This is a brief example demonstrating the use of the soundPool class. For production, you would consider using a HashMap to keep track of your sounds, and have only one method to play them. Also, to be memory friendly, unloading sounds when no longer needed or releasing the soundPool altogether is a good idea.</p>
<p><em>soundPool.unload(ringSound)</em>;<br />
or<br />
<em>soundPool.release();</em></p>
<p><a href="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/05/soundPool.png"><img class="aligncenter size-full wp-image-3518" title="soundPool" src="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/05/soundPool.png" alt="" width="250" height="398" /></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.newyyz.com%2Fntgsite%2F2012%2F05%2Fandroid-using-the-soundpool-class%2F&amp;title=Android%3A%20Using%20the%20SoundPool%20class"><img src="http://www.newyyz.com/ntgsite/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.newyyz.com/ntgsite/2012/05/android-using-the-soundpool-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing &#8220;Unknown Problem&#8221; in Adobe Flash Builder</title>
		<link>http://www.newyyz.com/ntgsite/2012/03/fixing-unknown-problem-in-adobe-flash-builder/</link>
		<comments>http://www.newyyz.com/ntgsite/2012/03/fixing-unknown-problem-in-adobe-flash-builder/#comments</comments>
		<pubDate>Fri, 16 Mar 2012 18:14:34 +0000</pubDate>
		<dc:creator>Chad Upton</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[flash builder]]></category>
		<category><![CDATA[flex problem]]></category>
		<category><![CDATA[unknown problem]]></category>

		<guid isPermaLink="false">http://www.newyyz.com/ntgsite/?p=3088</guid>
		<description><![CDATA[By Chad Upton - senior consultant I&#8217;m not sure what causes it, but I was seeing it a lot for a while. When it first appeared, I checked google to see if anyone else had the same problem. No luck there. Then I talked to Derek Santos and Alain Thibodeau and they had seen it [...]]]></description>
			<content:encoded><![CDATA[<p>By Chad Upton -<em> senior consultant</em></p>
<p>I&#8217;m not sure what causes it, but I was seeing it a lot for a while.</p>
<p><a href="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/01/Unknown-Problem.png"><img class="aligncenter size-full wp-image-3457" title="Unknown-Problem" src="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/01/Unknown-Problem.png" alt="" width="363" height="124" /></a></p>
<p>When it first appeared, I checked google to see if anyone else had the same problem. No luck there. Then I talked to Derek Santos and Alain Thibodeau and they had seen it as well. Here&#8217;s what we&#8217;ve found takes care of it:</p>
<ol>
<li>Close all open tabs in Flash Builder (middle click on tab or left click on the x on the tab)</li>
<li>Close all open projects in Flash Builder (right click on project &gt; close project)</li>
<li>Close Flash Builder</li>
<li>Open Flash Builder</li>
<li>Open any necessary projects</li>
<li>Clean All (Project &gt; Clean &gt; Clean All Projects)</li>
<li>Build and Run</li>
</ol>
<div>So far, that&#8217;s worked every time. You may also want to <a href="http://www.newyyz.com/ntgsite/2012/01/how-to-disable-design-view-in-flash-builder/">disable design view</a> to see if that helps.</div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.newyyz.com%2Fntgsite%2F2012%2F03%2Ffixing-unknown-problem-in-adobe-flash-builder%2F&amp;title=Fixing%20%26%238220%3BUnknown%20Problem%26%238221%3B%20in%20Adobe%20Flash%20Builder"><img src="http://www.newyyz.com/ntgsite/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.newyyz.com/ntgsite/2012/03/fixing-unknown-problem-in-adobe-flash-builder/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What&#8217;s Your Backup Plan?</title>
		<link>http://www.newyyz.com/ntgsite/2012/02/whats-your-backup-plan/</link>
		<comments>http://www.newyyz.com/ntgsite/2012/02/whats-your-backup-plan/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 14:58:12 +0000</pubDate>
		<dc:creator>oliverm</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[General Knowledge]]></category>

		<guid isPermaLink="false">http://www.newyyz.com/ntgsite/?p=3357</guid>
		<description><![CDATA[As developers, people assume that we&#8217;ve got some bullet-proof backup system for all of our code, documents and media. In most cases, nothing could be farther from the truth. Ask yourself these questions: If your computer blew up right now, how long would it take to restore, recreate or re-download all the files that it [...]]]></description>
			<content:encoded><![CDATA[<p>As developers, people assume that we&#8217;ve got some bullet-proof backup system for all of our code, documents and media. In most cases, nothing could be farther from the truth.</p>
<p>Ask yourself these questions: If your computer blew up right now, how long would it take to restore, recreate or re-download all the files that it currently contains? How long would it take until you&#8217;re productive again?</p>
<p>If your honest answer is more than &#8220;a couple of hours&#8221;, read on&#8230;</p>
<p>If you use a computer regulary, take note: it will happen. It may be while you&#8217;re working on an important document, or when you&#8217;re trying to boot up in the morning. And it will happen at the worst possible time. Your system will be toast.</p>
<p>So how can you shield yourself from this impending disaster? The following is a description of my backup routine. Feel free to take the parts you need to build your own.</p>
<ol>
<li>All code I write goes into a repository, such as SVN or GIT, typically several times a day. Whether it&#8217;s for work or a personal project, I have no interest in re-writing code. I&#8217;m a developer, so I&#8217;m more interesting in writing *new* code;)</li>
<li>I own a small <a href="http://www.dlink.ca/products/?pid=509" target="_blank">FTP device</a> which has two mirrored 2TB drives. After a year of use, I&#8217;ve still got 1.6TB remaining, so I&#8217;ll be OK for a few more years with this capacity.</li>
<li>I purchased the Linux/Windows version of <a href="http://www.scootersoftware.com/" target="_blank">Beyond Compare</a> which allows you to compare files and folders on your local machine, across the network or over FTP. I love the ability so set up different comparison sessions so I can quickly see what&#8217;s out of sync between two folders. During a typlical work day, I might sync up two or three times, depending on how many bits I&#8217;m generating.</li>
<li>Found a good YouTube video or legally-aquired MP3? Don&#8217;t make these files part of your backup. If they&#8217;re worth keeping, burn them onto a DVD and free up your hard disk space. I do the same with the plethora of Linux Live CDs that I download as ISOs.</li>
<li>Discipline. It took a few data disasters before I finally woke up and became obsessed with backing up my stuff. Today I&#8217;ve actually got four copies of my important data: the FTP device, two desktops (home and work) and a laptop. If any one of these fails I can use one of the other three to get back to business.</li>
</ol>
<p>Reply to this post if you have any other great backup strategies to share!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.newyyz.com%2Fntgsite%2F2012%2F02%2Fwhats-your-backup-plan%2F&amp;title=What%26%238217%3Bs%20Your%20Backup%20Plan%3F"><img src="http://www.newyyz.com/ntgsite/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.newyyz.com/ntgsite/2012/02/whats-your-backup-plan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fast Line Rendering in WPF</title>
		<link>http://www.newyyz.com/ntgsite/2012/02/fast-line-rendering-in-wpf/</link>
		<comments>http://www.newyyz.com/ntgsite/2012/02/fast-line-rendering-in-wpf/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 14:22:39 +0000</pubDate>
		<dc:creator>seanh</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.newyyz.com/ntgsite/?p=3099</guid>
		<description><![CDATA[Fast Rendering in WPF using GDI using a Background Thread  The Problem Rendering tens of thousands of lines was taking several seconds to render in WPF. I was trying to draw a graph with a dozen series or so in real-time (the data comes in at 10Hz, but we&#8217;d settle for 1 or 2 frames [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Fast Rendering in WPF using GDI using a Background Thread</strong></p>
<p><span style="font-family: Times New Roman; font-size: small;"> </span><strong>The Problem</strong></p>
<p>Rendering tens of thousands of lines was taking several seconds to render in WPF.</p>
<p>I was trying to draw a graph with a dozen series or so in real-time (the data comes in at 10Hz, but we&#8217;d settle for 1 or 2 frames per second as a worst case). Each series had over 1,000 data points which I represented as a line graph, and implemented with a Path object that had a StreamGeometry. This should have been the fastest way to draw a path, and profiling <em>my code</em> it was pretty fast. However, the actual rendering <em>on the render thread </em>took a many seconds and this made the UI unresponsive (it needs the render thread too, of course).</p>
<p><strong>What I did</strong></p>
<p>I looked at Petzold&#8217;s<span style="text-decoration: underline;"> <a href="http://msdn.microsoft.com/en-us/magazine/dd483292.aspx">article</a></span> and it made drawing the paths very fast. The hang up was still in the render thread. That solution helps if you have a lot of objects. I actually have about 12 paths, but they are composed of 10s of 1000&#8242;s of lines. My best theory is that the GPU is turning all those lines into pairs of triangles and that&#8217;s surprising slower than doing <span style="text-decoration: underline;"><a href="http://en.wikipedia.org/wiki/Bresenham's_line_algorithm">Bresenham&#8217;s</a></span> algorithm in software. See Jeremiah Morril&#8217;s <span style="text-decoration: underline;"><a href="http://jeremiahmorrill.com/2011/02/14/a-critical-deep-dive-into-the-wpf-rendering-system/">deep dive into wpf rendering</a></span>.</p>
<p>It&#8217;s shocking (to me) that software rendering would be so much faster than hardware rendering. I haven&#8217;t verified this, but I believe the GPU is rendering each line as two triangles as if it were a rectangle. And apparently this is much slower than drawing a simple line.</p>
<p>Using <a href="http://en.wikipedia.org/wiki/GDI">GDI+</a> to draw the lines on a bitmap gave me performance improvement of two orders of magnitude. (I guess GPU development has been driven by the game world where fast rendering of polygons for 3D is where the money is at.)</p>
<p>I&#8217;m hoping to get some time to try out Direct2D to see how it performs at drawing lines. Alas, that wouldn&#8217;t work for my project because Direct2D isn&#8217;t supported in older versions of windows. I don&#8217;t know if it would help since it uses the two-triangle method of drawing lines.</p>
<p>A huge bonus using the GDI library is that I can chose which thread to do the line rendering. Using a background thread keeps the rest of the UI responsive. Once the bitmap is rendered, it&#8217;s copied to the screen in an Image control (the render thread then renders this image, which is a super fast bitmap copy). Since I only allow one background thread, additional requests to draw are ignored until my renderer has finished: A simple way to adjust the frame-rate for the CPU.</p>
<p><strong>Acknowledgements and References</strong></p>
<p>Thanks for <span style="text-decoration: underline;"><a href="http://khason.net/blog/how-to-high-performance-graphics-in-wpf/">Tamir Khason</a></span> for pointing me in the right direction for creating an interop bitmap. Thanks to Dwayne Need for getting me going with a<span style="text-decoration: underline;"> <a href="http://blogs.msdn.com/b/dwayneneed/archive/2007/04/26/multithreaded-ui-hostvisual.aspx">HostVisual to draw into.</a></span></p>
<p>And see this <span style="text-decoration: underline;"><a href="http://www.kynosarges.de/WpfPerformance.html">blog</a></span> for an excellent analysis of the speed of different techniques. For me drawing direct <em>aliased</em> lines was the key. So GDI+ was the way to go. I considered Direct2D, but if it uses the GPU, it may turn out to have the same problem WPF did. I&#8217;m hoping to try that eventually, but Direct2D doesn&#8217;t work in XP, and we have to stay compatible.</p>
<p><strong>The Code</strong></p>
<p>See my test program <span style="text-decoration: underline;"><a title="here" href="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/other/FastLineRenderer.zip">here</a></span></p>
<p><strong>Here are some of the key bits in the code: </strong></p>
<p>GraphCanvas.xaml is the user control for drawing the lines. All it has is an image control to host the bitmap. Just this:<br />
<a href="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/02/SH.FLR_.Xaml_.png"><img class="alignnone size-full wp-image-3281" title="Graphics Canvas Xaml" src="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/02/SH.FLR_.Xaml_.png" alt="Xaml Code for  graphics canvas" width="374" height="72" /></a></p>
<p>The code behind GraphControl.cs has a BackgroundWorker called RenderWorker that draws the paths with a couple of GDI calls.</p>
<p><a href="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/02/SH.FLR_.DoWork.png"><img class="alignnone size-full wp-image-3282" title="Do Work Method" src="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/02/SH.FLR_.DoWork.png" alt="" width="735" height="302" /></a></p>
<p>When that&#8217;s done, you just copy the bitmap into the image control.</p>
<p><a href="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/02/SH.FLR_.Completed1.png"><img class="alignnone size-full wp-image-3287" title="Completed Method" src="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/02/SH.FLR_.Completed1.png" alt="" width="653" height="320" /></a></p>
<p><span style="mso-spacerun: yes;"> </span></p>
<p>RenderData is my own structure, like Path it has figures and points to draw between. Normally I’d use a Path but it’s a dependency object and doesn&#8217;t move easily between threads.</p>
<p>Initialize() creates the bitmaps in a few lines of code. This is what Tamir and Dwayne Need&#8217;s blogs helped me with. See the code for the details.</p>
<p><a href="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/02/SH.FLR_.Init_.png"><img class="alignnone size-full wp-image-3286" title="Initialize method" src="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/02/SH.FLR_.Init_.png" alt="" width="735" height="269" /></a></p>
<p>The background rendering technique is a really powerful technique whenever you have to draw something that takes any length of time. The rest is all about getting fast lines.</p>
<p>I hope you find that useful. Please leave me a reply if you do.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.newyyz.com%2Fntgsite%2F2012%2F02%2Ffast-line-rendering-in-wpf%2F&amp;title=Fast%20Line%20Rendering%20in%20WPF"><img src="http://www.newyyz.com/ntgsite/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.newyyz.com/ntgsite/2012/02/fast-line-rendering-in-wpf/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>NTG becomes an Appcelerator Partner</title>
		<link>http://www.newyyz.com/ntgsite/2012/02/ntg-becomes-an-appcelerator-partner/</link>
		<comments>http://www.newyyz.com/ntgsite/2012/02/ntg-becomes-an-appcelerator-partner/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 19:37:16 +0000</pubDate>
		<dc:creator>Glenn</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.newyyz.com/ntgsite/?p=3222</guid>
		<description><![CDATA[NTG is pleased to announce a partnership with Appcelerator! While the market for mobile applications is larger than ever before, developing and supporting multiple platforms can be complicated and expensive.  Appcelerator is a new software company that is enabling businesses to employ Web developers to build intuitive, content-rich native applications for multiple devices using a common cross-platform code [...]]]></description>
			<content:encoded><![CDATA[<div id="cboxOverlay" style="display: none;"></div>
<div id="colorbox" style="padding-right: 0px; padding-bottom: 38px; display: none;"></div>
<div id="cboxOverlay" style="display: none;"></div>
<div id="colorbox" style="padding-right: 0px; padding-bottom: 38px; display: none;"></div>
<p>NTG is pleased to announce a partnership with Appcelerator!</p>
<p>While the market for mobile applications is larger than ever before, developing and supporting multiple platforms can be complicated and expensive.  Appcelerator is a new software company that is enabling businesses to employ Web developers to build intuitive, content-rich native applications for multiple devices using a common cross-platform code base. By using Appcelerator products, Web developers are able to:</p>
<ul>
<li><strong>Cut development time in half</strong> by building apps once and deploying on multiple platforms.</li>
<li><strong>Drive down development costs.</strong></li>
<li><strong>Avoid vendor lock-in </strong>by using an open platform that maximizes choices.</li>
</ul>
<p>NTG looks forward to reselling the Appcelerator platform and providing Appcelerator-related development and enablement services.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.newyyz.com%2Fntgsite%2F2012%2F02%2Fntg-becomes-an-appcelerator-partner%2F&amp;title=NTG%20becomes%20an%20Appcelerator%20Partner"><img src="http://www.newyyz.com/ntgsite/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.newyyz.com/ntgsite/2012/02/ntg-becomes-an-appcelerator-partner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Disable Design View in Flash Builder</title>
		<link>http://www.newyyz.com/ntgsite/2012/01/how-to-disable-design-view-in-flash-builder/</link>
		<comments>http://www.newyyz.com/ntgsite/2012/01/how-to-disable-design-view-in-flash-builder/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 23:44:54 +0000</pubDate>
		<dc:creator>Chad Upton</dc:creator>
				<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[design mode]]></category>
		<category><![CDATA[design view]]></category>
		<category><![CDATA[disable]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[flash builder]]></category>
		<category><![CDATA[memory]]></category>

		<guid isPermaLink="false">http://www.newyyz.com/ntgsite/?p=3092</guid>
		<description><![CDATA[By Chad Upton &#8211; senior consultant Disable Flash Builder&#8217;s &#8220;Design Mode&#8221; if you want to save some memory or avoid some errors that some plugins cause when using design view. It&#8217;s pretty straight forward, go to the Window menu and click &#8220;Enable Design Mode&#8221; to remove the checkmark:]]></description>
			<content:encoded><![CDATA[<p>By Chad Upton &#8211; senior consultant</p>
<p>Disable Flash Builder&#8217;s &#8220;Design Mode&#8221; if you want to save some memory or avoid some errors that some plugins cause when using design view. It&#8217;s pretty straight forward, go to the Window menu and click &#8220;Enable Design Mode&#8221; to remove the checkmark:</p>
<p><img class="aligncenter size-full wp-image-3210" title="Disable Flash Builder Design Mode" src="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/01/Disable-Design-Mode.png" alt="" width="417" height="405" /></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.newyyz.com%2Fntgsite%2F2012%2F01%2Fhow-to-disable-design-view-in-flash-builder%2F&amp;title=How%20to%20Disable%20Design%20View%20in%20Flash%20Builder"><img src="http://www.newyyz.com/ntgsite/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.newyyz.com/ntgsite/2012/01/how-to-disable-design-view-in-flash-builder/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flex Mobile: Skinning the ActionBar</title>
		<link>http://www.newyyz.com/ntgsite/2012/01/flex-mobile-skinning-the-actionbar/</link>
		<comments>http://www.newyyz.com/ntgsite/2012/01/flex-mobile-skinning-the-actionbar/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 21:10:07 +0000</pubDate>
		<dc:creator>alaint</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://www.newyyz.com/ntgsite/?p=3157</guid>
		<description><![CDATA[By Alain Thibodeau – Consultant In a Flex mobile application, the ActionBar is the main bar at the top which contains several content areas. These areas consists of the titleDisplay, actionGroup, titleGroup and navigationGroup skin parts. With a custom skin you can move these skin parts where you need them and add background images. I [...]]]></description>
			<content:encoded><![CDATA[<p><em>By Alain Thibodeau – Consultant</em></p>
<p>In a Flex mobile application, the ActionBar is the main bar at the top which contains several content areas. These areas consists of the titleDisplay, actionGroup, titleGroup and navigationGroup skin parts. With a custom skin you can move these skin parts where you need them and add background images.</p>
<p>I first hit Photoshop and created my visuals for the ActionBar as shown below. (I know most of you designers out there will give me the &#8220;eye brow&#8221; with my design, but go easy on me please…)</p>
<p><img class="alignnone size-full wp-image-3158" title="ActionBarSkinPS" src="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/01/actionbarps.png" alt="" width="499" height="149" /></p>
<p>I sliced out the logo and a 3 pixel slice of the bar. Looking like this:</p>
<p><img class="alignnone size-full wp-image-3160" title="ActionBarBGSlice" src="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/01/bar.png" alt="" width="3" height="122" />      <img class="alignnone size-full wp-image-3161" title="ActionBarLogoSlice" src="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/01/logo.png" alt="" width="144" height="122" /></p>
<p>I then created a Flex Mobile Project. In the main project file, I referenced a css file which contains this code:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">@<span style="color: #004993;">namespace</span> s <span style="color: #990000;">&quot;library://ns.adobe.com/flex/spark&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
s<span style="color: #000066; font-weight: bold;">|</span>ActionBar <span style="color: #000000;">&#123;</span><br />
skinClass<span style="color: #000066; font-weight: bold;">:</span>ClassReference<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;skins.CustomActionBarSkin&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
defaultButtonAppearance<span style="color: #000066; font-weight: bold;">:</span> beveled<span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span><br />
<br />
s<span style="color: #000066; font-weight: bold;">|</span>ActionBar #titleDisplay <span style="color: #000000;">&#123;</span><br />
fontWeight<span style="color: #000066; font-weight: bold;">:</span>normal<span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #004993;">color</span><span style="color: #000066; font-weight: bold;">:</span> #000000<span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span><br />
<br />
s<span style="color: #000066; font-weight: bold;">|</span>ActionBar #titleGroup <span style="color: #000000;">&#123;</span><br />
fontWeight<span style="color: #000066; font-weight: bold;">:</span>normal<span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #004993;">color</span><span style="color: #000066; font-weight: bold;">:</span> #FFFFFF<span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span></div></td></tr></tbody></table></div>
<p>The most important part of the css file is the declaration of the skin class for our custom skin. The other styles are for the text in the titleGroup  and titleDisplay groups.</p>
<p>Here is the custom action bar mxml skin.  It could have been written in ActionScript, however, I did not notice any performance issues with mxml.</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span><br />
<span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Skin xmlns<span style="color: #000066; font-weight: bold;">:</span>fx=<span style="color: #990000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; xmlns<span style="color: #000066; font-weight: bold;">:</span>s=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/spark&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fx<span style="color: #000066; font-weight: bold;">:</span>Metadata<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>HostComponent<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;spark.components.ActionBar&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fx<span style="color: #000066; font-weight: bold;">:</span>Metadata<span style="color: #000066; font-weight: bold;">&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>states<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;titleContentWithActionAndNavigation&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;titleContentWithNavigation&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;titleContentWithAction&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;titleContent&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;titleWithActionAndNavigation&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;titleWithNavigation&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;titleWithAction&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;title&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>states<span style="color: #000066; font-weight: bold;">&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Image <span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;@Embed('/assets/images/bar.png')&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;0&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;0&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #004993;">scaleMode</span>=<span style="color: #990000;">&quot;stretch&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Image <span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;@Embed('/assets/images/logo.png')&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;horizontalCenter=<span style="color: #990000;">&quot;0&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Group id=<span style="color: #990000;">&quot;navigationGroup&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;12&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;15&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Group id=<span style="color: #990000;">&quot;titleGroup&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;10&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;68&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Group id=<span style="color: #990000;">&quot;actionGroup&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;12&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;15&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Label id=<span style="color: #990000;">&quot;titleDisplay&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;horizontalCenter=<span style="color: #990000;">&quot;0&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;8&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
<span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>Skin<span style="color: #000066; font-weight: bold;">&gt;</span></div></td></tr></tbody></table></div>
<p>The modifications to the skin are adding the background images and moving the skin parts where we need them. In this case, my slice of the background is stretched across the width of the application. The logo is then put on top of the bar and centered, aligning itself with the lines and shadows.</p>
<p>What I didn’t add is consideration for different dpis. This could be accomplished by having different images for the different screen resolutions.</p>
<p>Lastly, here is the view that defines what goes in the content areas. We could extend the ActionBar and add more skin parts as needed. In our case we are using the &#8220;titleContent&#8221; SkinPart for some form of subtitle text area.</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span><br />
<span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>View xmlns<span style="color: #000066; font-weight: bold;">:</span>fx=<span style="color: #990000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; xmlns<span style="color: #000066; font-weight: bold;">:</span>s=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/spark&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; title=<span style="color: #990000;">&quot;Action Bar Skin&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>navigationContent<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Back&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>navigationContent<span style="color: #000066; font-weight: bold;">&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>titleContent<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Label <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;Some Text Here&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>titleContent<span style="color: #000066; font-weight: bold;">&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>actionContent<span style="color: #000066; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Action&quot;</span> <span style="color: #000066; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>actionContent<span style="color: #000066; font-weight: bold;">&gt;</span><br />
<br />
<span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>View<span style="color: #000066; font-weight: bold;">&gt;</span></div></td></tr></tbody></table></div>
<p>Here is what the application looks like with the custom ActionBarSkin:</p>
<p><img class="alignnone size-full wp-image-3173" title="ActionBarSkinOutcome" src="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/01/ActionBarSkinOutcome1.png" alt="" width="499" height="282" /></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.newyyz.com%2Fntgsite%2F2012%2F01%2Fflex-mobile-skinning-the-actionbar%2F&amp;title=Flex%20Mobile%3A%20Skinning%20the%20ActionBar"><img src="http://www.newyyz.com/ntgsite/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.newyyz.com/ntgsite/2012/01/flex-mobile-skinning-the-actionbar/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Creating an HRule in MXML with Spark Components</title>
		<link>http://www.newyyz.com/ntgsite/2012/01/creating-an-hrule-in-mxml-with-spark-components/</link>
		<comments>http://www.newyyz.com/ntgsite/2012/01/creating-an-hrule-in-mxml-with-spark-components/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 23:24:15 +0000</pubDate>
		<dc:creator>Chad Upton</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[4.6]]></category>
		<category><![CDATA[hrule]]></category>
		<category><![CDATA[line]]></category>
		<category><![CDATA[mx]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[solidcolorstroke]]></category>
		<category><![CDATA[spark]]></category>
		<category><![CDATA[vector]]></category>
		<category><![CDATA[vrule]]></category>

		<guid isPermaLink="false">http://www.newyyz.com/ntgsite/?p=3056</guid>
		<description><![CDATA[By Chad Upton &#8211; senior consultant Although there is an MX HRule component, there is not a Spark equivalent. You could still use the mx component, but it&#8217;s better to use a vector graphic for something as simple as a straight line &#8211; particularly if you&#8217;re building a mobile application. For a horizontal rule, you can [...]]]></description>
			<content:encoded><![CDATA[<p>By Chad Upton &#8211; <em>senior consultant</em></p>
<p><img class="size-full wp-image-3073 alignleft" style="border-style: initial; border-color: initial;" title="flex" src="http://www.newyyz.com/ntgsite/wp/wp-content/uploads/2012/01/flex.jpg" alt="" width="90" height="90" /></p>
<p>Although there is an MX HRule component, there is not a Spark equivalent. You could still use the mx component, but it&#8217;s better to use a vector graphic for something as simple as a straight line &#8211; particularly if you&#8217;re building a mobile application.</p>
<p>For a horizontal rule, you can simple set the width of the line, the color, and the weight (stroke/thickness).</p>
<div class="codecolorer-container mxml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="mxml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Line</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #7400FF;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:stroke</span><span style="color: #7400FF;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColorStroke</span> color=<span style="color: #ff0000;">&quot;0x000000&quot;</span> weight=<span style="color: #ff0000;">&quot;2&quot;</span><span style="color: #7400FF;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:stroke</span><span style="color: #7400FF;">&gt;</span></span><br />
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Line</span><span style="color: #7400FF;">&gt;</span></span></div></td></tr></tbody></table></div>
<p>You can also draw a line from point to point:</p>
<div class="codecolorer-container mxml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="mxml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Line</span> xFrom=<span style="color: #ff0000;">&quot;10&quot;</span> xTo=<span style="color: #ff0000;">&quot;20&quot;</span> yFrom=<span style="color: #ff0000;">&quot;10&quot;</span> yTo=<span style="color: #ff0000;">&quot;20&quot;</span><span style="color: #7400FF;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:stroke</span><span style="color: #7400FF;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColorStroke</span> color=<span style="color: #ff0000;">&quot;0xFF0000&quot;</span> weight=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #7400FF;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:stroke</span><span style="color: #7400FF;">&gt;</span></span><br />
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Line</span><span style="color: #7400FF;">&gt;</span></span></div></td></tr></tbody></table></div>
<p>Be sure to <a href="https://www.facebook.com/NewTorontoGroup" target="_blank">“like” us on facebook</a> to stay in the loop and checkout our <a href="http://www.newyyz.com/ntgsite/training/find_a_course/">course calendar</a> for flex, html5, javascript, and other platform training programs &#8212; online and in the classroom.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.newyyz.com%2Fntgsite%2F2012%2F01%2Fcreating-an-hrule-in-mxml-with-spark-components%2F&amp;title=Creating%20an%20HRule%20in%20MXML%20with%20Spark%20Components"><img src="http://www.newyyz.com/ntgsite/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.newyyz.com/ntgsite/2012/01/creating-an-hrule-in-mxml-with-spark-components/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

