<?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/"
	>

<channel>
	<title>FlashInit</title>
	<atom:link href="http://www.flashinit.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flashinit.com/blog</link>
	<description>Random AS3  thoughts and experiments</description>
	<pubDate>Wed, 13 Jan 2010 22:11:12 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mute / UnMute Sound AS3</title>
		<link>http://www.flashinit.com/blog/2010/01/13/mute-unmute-sound-as/</link>
		<comments>http://www.flashinit.com/blog/2010/01/13/mute-unmute-sound-as/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 22:11:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[AS3]]></category>

		<category><![CDATA[flash]]></category>

		<category><![CDATA[movieclip]]></category>

		<category><![CDATA[mute]]></category>

		<category><![CDATA[timeline]]></category>

		<category><![CDATA[unmute]]></category>

		<guid isPermaLink="false">http://www.flashinit.com/blog/?p=24</guid>
		<description><![CDATA[If you need to mute/unmute a sound in a MovieClips timeline (eg. if you have a player that loads external swfs)
Try using SoundMixer and soundTransform like this:

1
2
3
4
5
6
7
8
import flash.media.SoundTransform;
import flash.media.SoundMixer;
&#160;
// Mute - sets volume to 0
SoundMixer.soundTransform = new SoundTransform&#40;0&#41;;
&#160;
//UnMute - sets volume to 1 (100%)
SoundMixer.soundTransform = new SoundTransform&#40;1&#41;;

Of course there are other ways to do it [...]]]></description>
			<content:encoded><![CDATA[<p>If you need to mute/unmute a sound in a MovieClips timeline (eg. if you have a player that loads external swfs)<br />
Try using SoundMixer and soundTransform like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.media</span>.<span style="color: #004993;">SoundTransform</span>;
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.media</span>.<span style="color: #004993;">SoundMixer</span>;
&nbsp;
<span style="color: #009900;">// Mute - sets volume to 0</span>
<span style="color: #004993;">SoundMixer</span>.<span style="color: #004993;">soundTransform</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">SoundTransform</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #009900;">//UnMute - sets volume to 1 (100%)</span>
<span style="color: #004993;">SoundMixer</span>.<span style="color: #004993;">soundTransform</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">SoundTransform</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>;</pre></td></tr></table></div>

<p>Of course there are other ways to do it but this was exactly what I needed for my project and it worked just fine.<br />
Feel free to comment other ways to do it.</p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashinit.com/blog/2010/01/13/mute-unmute-sound-as/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to use Static properties and methods to simplify your tasks in Flash</title>
		<link>http://www.flashinit.com/blog/2009/04/25/how-to-use-static-properties-and-methods-to-simplify-your-tasks/</link>
		<comments>http://www.flashinit.com/blog/2009/04/25/how-to-use-static-properties-and-methods-to-simplify-your-tasks/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 12:18:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[ActionScript]]></category>

		<category><![CDATA[AS3]]></category>

		<category><![CDATA[class]]></category>

		<category><![CDATA[static methods]]></category>

		<category><![CDATA[static properties]]></category>

		<category><![CDATA[Utils]]></category>

		<guid isPermaLink="false">http://www.flashinit.com/blog/?p=19</guid>
		<description><![CDATA[Do you write your code over and over every time you need to align an image to the stage center of your project? or maybe for some other task? I know I used to before I learned about static properties and methods, of course I had some snippets for that stored somewhere but still this [...]]]></description>
			<content:encoded><![CDATA[<p>Do you write your code over and over every time you need to align an image to the stage center of your project? or maybe for some other task? I know I used to before I learned about static properties and methods, of course I had some snippets for that stored somewhere but still this is not the best solution.</p>
<p>This is very useful because it allows you to use properties from a class without having to import it first. Basically all you need to do is put the word static when declaring the properties and methods inside your class.</p>
<p><strong>Utils.as</strong></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>	
	<span style="color: #3f5fbf;">/**
	 *  Description
	 *    
	 *  @langversion ActionScript 3
	 *  @playerversion Flash 9.0.0
	 *
	 *  @author Pedro Canterini
	 *  @since  11.04.2009
	 */</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">DisplayObject</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Utils
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #6699cc; font-weight: bold;">var</span> myStr<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;My tring here...&quot;</span>;
&nbsp;
		<span style="color: #3f5fbf;">/**
		 *   @constructor
		 */</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Utils<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #009900;">//super();</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009900;">//---------------------------------------</span>
		<span style="color: #009900;">// Align to center</span>
		<span style="color: #009900;">//---------------------------------------</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> alignToCenter<span style="color: #000000;">&#40;</span>obj<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</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>
			obj.<span style="color: #004993;">x</span> = obj.<span style="color: #004993;">stage</span>.<span style="color: #004993;">stageWidth</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span> <span style="color: #000000; font-weight: bold;">-</span> obj.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span>;
			obj.<span style="color: #004993;">y</span> = obj.<span style="color: #004993;">stage</span>.<span style="color: #004993;">stageHeight</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span> <span style="color: #000000; font-weight: bold;">-</span> obj.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p><strong>How to use it:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">Utils.alignToCenter<span style="color: #000000;">&#40;</span>theDisplayObject<span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>Notice that you can align any display object to the center of the stage not just images.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashinit.com/blog/2009/04/25/how-to-use-static-properties-and-methods-to-simplify-your-tasks/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AS3 lightBox class</title>
		<link>http://www.flashinit.com/blog/2009/04/24/as3-lightbox-class/</link>
		<comments>http://www.flashinit.com/blog/2009/04/24/as3-lightbox-class/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 03:09:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[AS3]]></category>

		<category><![CDATA[ActionScript]]></category>

		<category><![CDATA[class]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[Component]]></category>

		<category><![CDATA[LightBox]]></category>

		<guid isPermaLink="false">http://www.flashinit.com/blog/?p=10</guid>
		<description><![CDATA[This is not ready but I would like to share it anyways, for two reasons: I couldn&#8217;t find a free class (or didn&#8217;t look hard enough) and someone else might be looking for it. And also so people can take a look at my code and point something that could be improved.
I will post the [...]]]></description>
			<content:encoded><![CDATA[<p>This is not ready but I would like to share it anyways, for two reasons: I couldn&#8217;t find a free class (or didn&#8217;t look hard enough) and someone else might be looking for it. And also so people can take a look at my code and point something that could be improved.</p>
<p>I will post the final version once it is ready.</p>
<p><strong>LightBox.as</strong></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900;">//AS3///////////////////////////////////////////////////////////////////////////</span>
<span style="color: #009900;">// </span>
<span style="color: #009900;">//  FlashInit.com</span>
<span style="color: #009900;">// </span>
<span style="color: #009900;">////////////////////////////////////////////////////////////////////////////////</span>
&nbsp;
<span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>	
	<span style="color: #3f5fbf;">/**
	 *  LightBox Class
	 *    
	 *  @langversion ActionScript 3
	 *  @playerversion Flash 9.0.0
	 *
	 *  @author Pedro Canterini
	 *  @since  22.04.2009
	 */</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Sprite</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Loader</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">LoaderInfo</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">DisplayObject</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">Event</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">ProgressEvent</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.net</span>.<span style="color: #004993;">URLRequest</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> LightBox extends <span style="color: #004993;">Sprite</span>
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #009900;">//---------------------------------------</span>
		<span style="color: #009900;">// PRIVATE VARIABLES</span>
		<span style="color: #009900;">//---------------------------------------</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _imageHolder<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Sprite</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _loader<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Loader</span>;
&nbsp;
		<span style="color: #3f5fbf;">/**
		 *   @constructor
		 */</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> LightBox<span style="color: #000000;">&#40;</span><span style="color: #004993;">url</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</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;lightbox is on! load: &quot;</span>, <span style="color: #004993;">url</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #6699cc; font-weight: bold;">var</span> req<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: #004993;">url</span><span style="color: #000000;">&#41;</span>;
			_loader = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Loader</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			_loader.<span style="color: #004993;">contentLoaderInfo</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>, onComplete, <span style="color: #0033ff; font-weight: bold;">false</span>, <span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span>;
			_loader.<span style="color: #004993;">contentLoaderInfo</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">ProgressEvent</span>.<span style="color: #004993;">PROGRESS</span>, handleProgress, <span style="color: #0033ff; font-weight: bold;">false</span>, <span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span>;
			_loader.<span style="color: #004993;">load</span><span style="color: #000000;">&#40;</span>req<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009900;">//---------------------------------------</span>
		<span style="color: #009900;">// PUBLIC METHODS</span>
		<span style="color: #009900;">//---------------------------------------</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> alignToCenter<span style="color: #000000;">&#40;</span>object<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</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>
			object.<span style="color: #004993;">x</span> = <span style="color: #000000;">&#40;</span>object.<span style="color: #004993;">stage</span>.<span style="color: #004993;">stageWidth</span> <span style="color: #000000; font-weight: bold;">-</span> object.<span style="color: #004993;">width</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span>;
			object.<span style="color: #004993;">y</span> = <span style="color: #000000;">&#40;</span>object.<span style="color: #004993;">stage</span>.<span style="color: #004993;">stageHeight</span> <span style="color: #000000; font-weight: bold;">-</span> object.<span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009900;">//---------------------------------------</span>
		<span style="color: #009900;">// PRIVATE METHODS</span>
		<span style="color: #009900;">//---------------------------------------</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handleProgress<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">ProgressEvent</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> percent<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = <span style="color: #004993;">int</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>event.<span style="color: #004993;">bytesLoaded</span> <span style="color: #000000; font-weight: bold;">/</span> event.<span style="color: #004993;">bytesTotal</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>percent<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onComplete<span style="color: #000000;">&#40;</span>event<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>
			_loader.<span style="color: #004993;">contentLoaderInfo</span>.<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">COMPLETE</span>, onComplete<span style="color: #000000;">&#41;</span>;
			handleImage<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handleImage<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: #3f5fbf;">/* create holder for the bitmap */</span>
			_imageHolder = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>_imageHolder<span style="color: #000000;">&#41;</span>;
			_imageHolder.<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>_loader<span style="color: #000000;">&#41;</span>;
&nbsp;
			<span style="color: #3f5fbf;">/* align object */</span>
			alignToCenter<span style="color: #000000;">&#40;</span>_imageHolder<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>in order to use it just create a new Instance of it:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> lightBox<span style="color: #000000; font-weight: bold;">:</span>LightBox = <span style="color: #0033ff; font-weight: bold;">new</span> LightBox<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;assets/imgs/retratos/img-001.jpg&quot;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>lightBox<span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>I am working on the background and a loader and I will post as soon as  they are done and integrated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashinit.com/blog/2009/04/24/as3-lightbox-class/feed/</wfw:commentRss>
		</item>
		<item>
		<title>trace(&#8221;Hello World!&#8221;);</title>
		<link>http://www.flashinit.com/blog/2009/04/24/tracehello-world/</link>
		<comments>http://www.flashinit.com/blog/2009/04/24/tracehello-world/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 23:36:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[ActionScript]]></category>

		<category><![CDATA[AS3]]></category>

		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://www.flashinit.com/blog/?p=3</guid>
		<description><![CDATA[Hi!
I intent to have this blog as a tool to share my ActionScript 3 experiences, learn something from my erros and hopefully provide and share solutions for others having the same issues that I once had.
Please feel free to say anything and also provide better solutions/improvements for all the code you might find here.
Cheers
-Pedro
]]></description>
			<content:encoded><![CDATA[<p>Hi!</p>
<p>I intent to have this blog as a tool to share my ActionScript 3 experiences, learn something from my erros and hopefully provide and share solutions for others having the same issues that I once had.</p>
<p>Please feel free to say anything and also provide better solutions/improvements for all the code you might find here.</p>
<p>Cheers</p>
<p>-Pedro</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashinit.com/blog/2009/04/24/tracehello-world/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
