<?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>Pierrick Pluchon</title>
	<atom:link href="http://pierrickpluchon.fr/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://pierrickpluchon.fr/blog</link>
	<description>Flash &#38; web experimentations</description>
	<lastBuildDate>Tue, 23 Mar 2010 14:51:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>[AS3] A look into the MailChimp&#8217;s API</title>
		<link>http://pierrickpluchon.fr/blog/as3-a-look-into-the-mailchimps-api/</link>
		<comments>http://pierrickpluchon.fr/blog/as3-a-look-into-the-mailchimps-api/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 14:51:09 +0000</pubDate>
		<dc:creator>Pierrick</dc:creator>
				<category><![CDATA[AS3]]></category>

		<guid isPermaLink="false">http://pierrickpluchon.fr/blog/?p=61</guid>
		<description><![CDATA[For a current project, i had to build a simple solution to suscribe to a newsletter without having to be redirected anywhere else.
MailChimp is an extremely powerful social tool, and probably the best email marketing platform available! Anyway, I will not cover MailChimp with praises, but if you are interested, just take a look.

Before using <a href="http://pierrickpluchon.fr/blog/as3-a-look-into-the-mailchimps-api/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>For a current project, i had to build a simple solution to suscribe to a newsletter without having to be redirected anywhere else.<br />
<a href="http://www.mailchimp.com/">MailChimp</a> is an extremely powerful social tool, and probably the best email marketing platform available! Anyway, I will not cover MailChimp with praises, but if you are interested, just take a look.</p>
<p><span id="more-61"></span></p>
<p>Before using the piece of code below, you need to create 3 things :</p>
<p>• A texfield named <em>emailAddress</em>,</p>
<p>• A submit button, let&#8217;s call it <em>submitBtn</em> (what an amazing name)!</p>
<p>• Finally, a respond textfield where in case of success or error a message wil be displayed. We will call it <em>responseText</em></p>
<p><em><span style="font-style: normal;">Now, the end of the code.</span></em></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900;">//api and list id keys</span>
<span style="color: #6699cc; font-weight: bold;">var</span> _api<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;YOUR_MAILCHIMP_API_KEY&quot;</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> _listID<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;LIST_ID_HERE&quot;</span>;
&nbsp;
<span style="color: #009900;">//text box handler</span>
emailAddress.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;email address&quot;</span>;
emailAddress.<span style="color: #004993;">tabIndex</span> = <span style="color: #000000; font-weight:bold;">1</span>;
emailAddress.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">FocusEvent</span>.<span style="color: #004993;">FOCUS_IN</span>, txtFocusIn<span style="color: #000000;">&#41;</span>;
emailAddress.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">FocusEvent</span>.<span style="color: #004993;">FOCUS_OUT</span>, txtFocusOut<span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> txtFocusIn<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">FocusEvent</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
        emailAddress.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;&quot;</span>;
<span style="color: #000000;">&#125;</span>
<span style="color: #339966; font-weight: bold;">function</span> txtFocusOut<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">FocusEvent</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
        <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>emailAddress.<span style="color: #004993;">text</span> == <span style="color: #990000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                emailAddress.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;email address&quot;</span>;
        <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #009900;">//button setup</span>
submitBtn.<span style="color: #004993;">buttonMode</span> = <span style="color: #0033ff; font-weight: bold;">true</span>;
submitBtn.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">CLICK</span>, submitForm<span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> submitForm<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
&nbsp;
        <span style="color: #6699cc; font-weight: bold;">var</span> email<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = emailAddress.<span style="color: #004993;">text</span>;
&nbsp;
        <span style="color: #009900;">//check if email is valid</span>
        <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>isValidEmail<span style="color: #000000;">&#40;</span>email<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
&nbsp;
                <span style="color: #009900;">//set response text</span>
                responseText.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;sending...&quot;</span>;
&nbsp;
                <span style="color: #009900;">//disable the submit button</span>
                submitBtn.<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">CLICK</span>, submitForm<span style="color: #000000;">&#41;</span>;
&nbsp;
                <span style="color: #009900;">//setup POST</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> variables<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">URLVariables</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLVariables</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;method=listSubscribe&amp;amp;output=xml&amp;amp;apikey=&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> _api <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot;&amp;amp;id=&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> _listID <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot;&amp;amp;email_address=&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> email <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot;&amp;amp;merge_vars=&quot;</span><span style="color: #000000;">&#41;</span>;
                <span style="color: #6699cc; font-weight: bold;">var</span> request<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">URLRequest</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLRequest</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                request.<span style="color: #004993;">url</span> = <span style="color: #990000;">&quot;http://api.mailchimp.com/1.2/?method=listSubscribe&quot;</span>;
                request.<span style="color: #004993;">method</span> = <span style="color: #004993;">URLRequestMethod</span>.<span style="color: #004993;">POST</span>;
                request.<span style="color: #004993;">data</span> = variables;
&nbsp;
                <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">loader</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">URLLoader</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLLoader</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                <span style="color: #004993;">loader</span>.<span style="color: #004993;">dataFormat</span> = <span style="color: #004993;">URLLoaderDataFormat</span>.<span style="color: #004993;">VARIABLES</span>;
                <span style="color: #004993;">loader</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">COMPLETE</span>, completeHandler<span style="color: #000000;">&#41;</span>;
&nbsp;
                <span style="color: #0033ff; font-weight: bold;">try</span> <span style="color: #000000;">&#123;</span>
                        <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;loading...&quot;</span><span style="color: #000000;">&#41;</span>;
                        responseText.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;loading...&quot;</span>;
                        <span style="color: #004993;">loader</span>.<span style="color: #004993;">load</span><span style="color: #000000;">&#40;</span>request<span style="color: #000000;">&#41;</span>;
                <span style="color: #000000;">&#125;</span>
                <span style="color: #0033ff; font-weight: bold;">catch</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">error</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Error</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                        <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;unable to load URL&quot;</span><span style="color: #000000;">&#41;</span>;
                        responseText.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Oh, something went wrong, please try again. Thanks!&quot;</span>;
                        <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">data</span><span style="color: #000000;">&#41;</span>;
                <span style="color: #000000;">&#125;</span>
                <span style="color: #339966; font-weight: bold;">function</span> completeHandler<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                        <span style="color: #6699cc; font-weight: bold;">var</span> _t<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #004993;">unescape</span><span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">data</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">//decode the url</span>
&nbsp;
                        <span style="color: #6699cc; font-weight: bold;">var</span> _xml<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">XMLList</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">XMLList</span><span style="color: #000000;">&#40;</span>_t<span style="color: #000000;">&#41;</span>; <span style="color: #009900;">//parse the xml</span>
                        <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>_xml.@<span style="color: #004993;">type</span><span style="color: #000000;">&#41;</span>;
                        <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_xml.@<span style="color: #004993;">type</span> == <span style="color: #990000;">&quot;array&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #009900;">//check to see if there is an error</span>
                                <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>_xml.<span style="color: #004993;">error</span><span style="color: #000000;">&#41;</span>;
                                responseText.<span style="color: #004993;">text</span> = _xml.<span style="color: #004993;">error</span>;
                                resetForm<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                        <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_xml.@<span style="color: #004993;">type</span> == <span style="color: #990000;">&quot;boolean&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #009900;">//check to see if successfully added</span>
                                <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;successfully added to list&quot;</span><span style="color: #000000;">&#41;</span>;
                                responseText.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;You have beeen successfully added to our list. Thank you!&quot;</span>;
                                resetForm<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                        <span style="color: #000000;">&#125;</span>
                <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span>
                <span style="color: #004993;">trace</span> <span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;email invalid&quot;</span><span style="color: #000000;">&#41;</span>;
        resetForm <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                responseText.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;invalid email!&quot;</span>;
        <span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #009900;">//validate given email</span>
<span style="color: #339966; font-weight: bold;">function</span> isValidEmail<span style="color: #000000;">&#40;</span>_e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span> <span style="color: #000000;">&#123;</span>
        <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">exp</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">RegExp</span> = <span style="color: #000000; font-weight: bold;">/^</span><span style="color: #000000;">&#91;</span>a<span style="color: #000000; font-weight: bold;">-</span>z<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>\w.<span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">+</span>@\w<span style="color: #000000;">&#91;</span>\w.<span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">+</span>\.<span style="color: #000000;">&#91;</span>\w.<span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">&#91;</span>a<span style="color: #000000; font-weight: bold;">-</span>z<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>a<span style="color: #000000; font-weight: bold;">-</span>z<span style="color: #000000;">&#93;</span>$<span style="color: #000000; font-weight: bold;">/</span>i;
    <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #004993;">exp</span>.<span style="color: #004993;">test</span><span style="color: #000000;">&#40;</span>_e<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #009900;">//reset the form elements</span>
<span style="color: #339966; font-weight: bold;">function</span> resetForm<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
        submitBtn.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">CLICK</span>, submitForm<span style="color: #000000;">&#41;</span>;
        emailAddress.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;email address&quot;</span>;
&nbsp;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>It was quite easy, right?</p>
]]></content:encoded>
			<wfw:commentRss>http://pierrickpluchon.fr/blog/as3-a-look-into-the-mailchimps-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[AS3] How to plug your microphone with a SoundSpectrum in Flash Player 10.1</title>
		<link>http://pierrickpluchon.fr/blog/as3-how-to-plug-your-microphone-with-a-soundspectrum-in-flash-player-10-1/</link>
		<comments>http://pierrickpluchon.fr/blog/as3-how-to-plug-your-microphone-with-a-soundspectrum-in-flash-player-10-1/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 17:27:41 +0000</pubDate>
		<dc:creator>Pierrick</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Experimentation]]></category>

		<guid isPermaLink="false">http://pierrickpluchon.fr/blog/?p=44</guid>
		<description><![CDATA[For a personal experimentation,  i wanted to have a look at the new features of the flash player 10.1, and more precisely concerning the microphone. Before 10.1, the flash player providen&#8217;t data for the microphone, but times are changing, for the happiness of every flash developper  .
Stop twaddling, and start coding!

Of course, for <a href="http://pierrickpluchon.fr/blog/as3-how-to-plug-your-microphone-with-a-soundspectrum-in-flash-player-10-1/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>For a personal experimentation,  i wanted to have a look at the new features of the flash player 10.1, and more precisely concerning the microphone. Before 10.1, the flash player providen&#8217;t data for the microphone, but times are changing, for the happiness of every flash developper <img src='http://pierrickpluchon.fr/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> .<br />
Stop twaddling, and start coding!<br />
<span id="more-44"></span><br />
Of course, for testing it you will need the flash player 10.1 and its SWC in order to compile it.</p>
<p>You can found them on the <a href="http://labs.adobe.com/downloads/flashplayer10.html">Adobe Labs</a>.</p>
<p><a title="Microphone and SoundSpectrum in FP 10.1" rel="lightbox[flash 550 400]" href="http://pierrickpluchon.fr/blog/wp-content/uploads/2010/02/test.swf">See the demo here !</a></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> _soundBytes<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">ByteArray</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">ByteArray</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> _micBytes<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">ByteArray</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> son<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Sound</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> sc<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">SoundChannel</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">pow</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000000; font-weight:bold;">0</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> myBar<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Sprite</span>;
&nbsp;
<span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span> = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ADDED_TO_STAGE</span>, <span style="color: #004993;">init</span><span style="color: #000000;">&#41;</span>;
        myBar=<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span>;
	initMic<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	initSound<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, drawLines<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
 <span style="color: #339966; font-weight: bold;">function</span> initMic<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> mic<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Microphone</span>=<span style="color: #004993;">Microphone</span>.<span style="color: #004993;">getMicrophone</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>mic<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
			mic.<span style="color: #004993;">setLoopBack</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000;">&#41;</span>;
			mic.<span style="color: #004993;">rate</span>=<span style="color: #000000; font-weight:bold;">44</span>;
			mic.<span style="color: #004993;">gain</span>=<span style="color: #000000; font-weight:bold;">60</span>;
			mic.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>SampleDataEvent.SAMPLE_DATA, micSampleDataHandler<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #009900;">// no mic</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
 <span style="color: #339966; font-weight: bold;">function</span> micSampleDataHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span>SampleDataEvent<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
	_micBytes=event.<span style="color: #004993;">data</span>;
	sc=son.<span style="color: #004993;">play</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
 <span style="color: #339966; font-weight: bold;">function</span> initSound<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
	son = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sound</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	son.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>SampleDataEvent.SAMPLE_DATA, soundSampleDataHandler<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> soundSampleDataHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span>SampleDataEvent<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>; i <span style="color: #000000; font-weight: bold;">&amp;</span>lt; <span style="color: #000000; font-weight:bold;">8192</span> <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; _micBytes.<span style="color: #004993;">bytesAvailable</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight:bold;">0</span>; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
		<span style="color: #6699cc; font-weight: bold;">var</span> sample<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=_micBytes.<span style="color: #004993;">readFloat</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		event.<span style="color: #004993;">data</span>.<span style="color: #004993;">writeFloat</span><span style="color: #000000;">&#40;</span>sample<span style="color: #000000;">&#41;</span>;
		event.<span style="color: #004993;">data</span>.<span style="color: #004993;">writeFloat</span><span style="color: #000000;">&#40;</span>sample<span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> drawLines<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
&nbsp;
	<span style="color: #004993;">SoundMixer</span>.<span style="color: #004993;">computeSpectrum</span><span style="color: #000000;">&#40;</span>_soundBytes, <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span>;
	myBar.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	myBar.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">lineStyle</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">2</span>,0xabc241<span style="color: #000000;">&#41;</span>;
	<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i=<span style="color: #000000; font-weight:bold;">0</span>; i<span style="color: #000000; font-weight: bold;">&amp;</span>lt;<span style="color: #000000; font-weight:bold;">256</span>; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
		<span style="color: #004993;">pow</span>=_soundBytes.<span style="color: #004993;">readFloat</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">200</span>;
		<span style="color: #004993;">pow</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">abs</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">pow</span><span style="color: #000000;">&#41;</span>;
		myBar.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>i<span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">2</span>, <span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #000000; font-weight:bold;">2</span>, <span style="color: #004993;">pow</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>myBar<span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Hope you liked it! Any comments are welcome <img src='http://pierrickpluchon.fr/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://pierrickpluchon.fr/blog/as3-how-to-plug-your-microphone-with-a-soundspectrum-in-flash-player-10-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello World!</title>
		<link>http://pierrickpluchon.fr/blog/hello-world/</link>
		<comments>http://pierrickpluchon.fr/blog/hello-world/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 17:27:10 +0000</pubDate>
		<dc:creator>Pierrick</dc:creator>
				<category><![CDATA[Non classé]]></category>

		<guid isPermaLink="false">http://pierrickpluchon.fr/blog/?p=42</guid>
		<description><![CDATA[Welcome on my very new blog (the old one was on dispatchevent.fr ). For those who follow me you know that english is not my native language, so don&#8217;t hesitate to correct my poor english !  
What can I say about me and this blog… Briefly, I&#8217;m fond of new technology and more specially <a href="http://pierrickpluchon.fr/blog/hello-world/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Welcome on my very new blog (the old one was on dispatchevent.fr ). For those who follow me you know that english is not my native language, so don&#8217;t hesitate to correct my poor english ! <img src='http://pierrickpluchon.fr/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>What can I say about me and this blog… Briefly, I&#8217;m fond of new technology and more specially web technology. In my upcoming posts will discover some personnal experimentations just for fun,  various student works, feature articles, or why not my works as freelancer!</p>
<p>Stay tuned <img src='http://pierrickpluchon.fr/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://pierrickpluchon.fr/blog/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
