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

<channel>
	<title>Action Script</title>
	<atom:link href="http://actionscript-blog.imaginationdev.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://actionscript-blog.imaginationdev.com</link>
	<description>Action Script 3 Articles and Tutorials</description>
	<pubDate>Mon, 28 Dec 2009 20:11:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Duplicate Movieclip Flash Action Script Enhanced</title>
		<link>http://actionscript-blog.imaginationdev.com/25/duplicate-movieclip-flash-action-script-enhanced/</link>
		<comments>http://actionscript-blog.imaginationdev.com/25/duplicate-movieclip-flash-action-script-enhanced/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 20:56:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Action Script 3.0]]></category>

		<category><![CDATA[Action Script Development]]></category>

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

		<category><![CDATA[Action Script 2]]></category>

		<category><![CDATA[Action Script 3]]></category>

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

		<category><![CDATA[add object to stage]]></category>

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

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

		<category><![CDATA[duplicate display objects action script 3]]></category>

		<category><![CDATA[duplicate movie action script flash]]></category>

		<category><![CDATA[Duplicate Movie Clip]]></category>

		<category><![CDATA[duplicate movie clip as3]]></category>

		<category><![CDATA[duplicate movie clip in flash]]></category>

		<category><![CDATA[flash action script duplicate objects]]></category>

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

		<guid isPermaLink="false">http://actionscript-blog.imaginationdev.com/?p=25</guid>
		<description><![CDATA[This tutorial provides a guideline for duplicating movie clips and display objects in flash action script.]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>Hi Guys, finally after a long time i have found some time to update the duplicate process for flash. It was prity strange why even in action script 3 there is no clone method. Any ways i have devised my own strategy for doing that.</p>
<p>To duplicate movieclip objects in flash as3 is realy easy. All you have to do is create a class against a movie clip and instantiate objects of that class and keep adding the objects on to Stage.</p>
<p>In the example attached I have created 3 display objects mcP1,mcP2 and mcP3 also i have associated these objects with 3 classes mcP1.as, mcP2.as and mcP3.as.</p>
<p>Now once this is done when you click on the generate button code randomly creates object of mcP1.as, mcP2.as and mcP3.as class and add them on to the stage.</p>
<p>This will duplicate the objects and perhaps the easiest way to duplicate objects in action script 3 and onwards. Easy !</p>
<p>I hope to will solve your purpose. Looking forward for your feed back. Thank you.</p>
<p><a href="../../../../../samples/duplicate-movieclip-flash/duplicate-movieclip-flash.zip">Download Latest Code Here</a></p>
<p>Working sample can be viewed on the following link.</p>
<p><a href="../../../../../samples/duplicate-movieclip-flash/pearl.swf">Image Slide Show enhanced</a></p>
<p>&nbsp;Awaiting feed back on this. Thank you</p>
]]></content:encoded>
			<wfw:commentRss>http://actionscript-blog.imaginationdev.com/25/duplicate-movieclip-flash-action-script-enhanced/feed/</wfw:commentRss>
		</item>
		<item>
		<title>XML and Flash Image Slide Show Enhanced</title>
		<link>http://actionscript-blog.imaginationdev.com/24/xml-flash-image-slide-show-enhanced/</link>
		<comments>http://actionscript-blog.imaginationdev.com/24/xml-flash-image-slide-show-enhanced/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 14:12:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Action Script 3.0]]></category>

		<category><![CDATA[Action Script Development]]></category>

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

		<category><![CDATA[banner slide show]]></category>

		<category><![CDATA[flash enhanced slide show]]></category>

		<category><![CDATA[flash image slide show]]></category>

		<category><![CDATA[flash image slide show enhanced]]></category>

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

		<category><![CDATA[flash xml image slideshow]]></category>

		<guid isPermaLink="false">http://actionscript-blog.imaginationdev.com/?p=24</guid>
		<description><![CDATA[&#160;
Hi , Guys i have been listening most of the comments. Busy schedual never allowed me to actually upgrade the code.
Here is the new enhanced code for image slide show using flash and XML. Well after getting feed back on the first code and listening to some requirements following enhancements have been made.
1- Memory optimization.
2. [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>Hi , Guys i have been listening most of the comments. Busy schedual never allowed me to actually upgrade the code.</p>
<p>Here is the new enhanced code for image slide show using flash and XML. Well after getting feed back on the first code and listening to some requirements following enhancements have been made.</p>
<p>1- Memory optimization.</p>
<p>2. More use of swap child.</p>
<p>3. Image Loader class added in to the system.</p>
<p>4. Optimized code.</p>
<p>5. Logo option.</p>
<p>6. Linked images to urls</p>
<p>7. Improved transitions code</p>
<p>&nbsp;</p>
<p>I hope to will solve your purpose. Looking forward for your feed back. Thank you.</p>
<p><a href="http://actionscript-blog.imaginationdev.com/samples/flash-banner-enhanced/banner.zip">Download Latest Code Here</a></p>
<p>Working sample can be viewed on the following link. </p>
<p><a href="http://actionscript-blog.imaginationdev.com/samples/flash-banner-enhanced/banner.html">Image Slide Show enhanced</a></p>
<p>&nbsp;Awaiting feed back on this. Thank you </p>
]]></content:encoded>
			<wfw:commentRss>http://actionscript-blog.imaginationdev.com/24/xml-flash-image-slide-show-enhanced/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flash XML Image Slide Show Action Script 3</title>
		<link>http://actionscript-blog.imaginationdev.com/21/flash-xml-image-slide-show-action-script-3/</link>
		<comments>http://actionscript-blog.imaginationdev.com/21/flash-xml-image-slide-show-action-script-3/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 19:46:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Action Script 3.0]]></category>

		<category><![CDATA[Action Script Development]]></category>

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

		<category><![CDATA[a flash picture slideshow]]></category>

		<category><![CDATA[a picture slideshow in flash]]></category>

		<category><![CDATA[action script image slide show]]></category>

		<category><![CDATA[banner slide show]]></category>

		<category><![CDATA[create slide show]]></category>

		<category><![CDATA[flash action script image slideshow]]></category>

		<category><![CDATA[flash action script slide show]]></category>

		<category><![CDATA[flash as3 slide show]]></category>

		<category><![CDATA[flash banner slide show]]></category>

		<category><![CDATA[flash image slide show]]></category>

		<category><![CDATA[flash image slide show action script]]></category>

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

		<category><![CDATA[flash image slideshow tutorial]]></category>

		<category><![CDATA[flash image slideshow with]]></category>

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

		<category><![CDATA[flash picture slide show]]></category>

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

		<category><![CDATA[flash picture slideshow for]]></category>

		<category><![CDATA[flash picture slideshow tutorial]]></category>

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

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

		<category><![CDATA[flash random image slideshow]]></category>

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

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

		<category><![CDATA[flash slideshow external images]]></category>

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

		<category><![CDATA[flash xml image slideshow]]></category>

		<category><![CDATA[free flash image slideshow]]></category>

		<category><![CDATA[free flash picture slideshow]]></category>

		<category><![CDATA[image slideshow]]></category>

		<category><![CDATA[image slideshow in flash]]></category>

		<category><![CDATA[image slideshow javascript]]></category>

		<category><![CDATA[images from flash slideshow]]></category>

		<category><![CDATA[javascript slideshow]]></category>

		<category><![CDATA[picture slide show in flash]]></category>

		<category><![CDATA[picture slideshow in flash]]></category>

		<category><![CDATA[slide show]]></category>

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

		<category><![CDATA[web slide show]]></category>

		<category><![CDATA[web slideshow]]></category>

		<guid isPermaLink="false">http://actionscript-blog.imaginationdev.com/?p=21</guid>
		<description><![CDATA[Flash xml image or picture image slideshow tutorial. types of images slide shows and how to create a dynamic image slide show or banner for your website using flash action script 3.]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">Hi, every one. I got many queries to write an article regarding How to create Image Slide Shows. Slide shows also referred as <strong>web slideshow or web slide shows</strong> can be made using <strong>java script</strong> and <strong>Flash</strong>. I prefer <strong>Flash action script Image Slide Shows over Javascript image slide shows</strong>.</p>
<p class="MsoNormal">Reason for that is with flash we can have variety of flash animations and effects available in action script api. Also we can make our customized flash animated effects. In java script we are very limited in terms of transitions and effects during the image slide show. Also with flash we can have <strong>interactive flash side show and banners. </strong>Another benefit of using flash image slide show is we can have text added to the animation.</p>
<p class="MsoNormal">In this <strong>flash tutorial</strong> we will learn how to <strong>create</strong> a basic <strong>image slide show in flash action script 3</strong>, and the type of applications that can be made by using flash image slide shows and few types of <strong>flash slideshows</strong>.</p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal">In future I plan to write a flash component for Image Slide show. I have attached the flash example and source code with the article you can download it at the link at the end of the article.</p>
<p class="MsoNormal">There are number of flash slide show or presentation creation software available online. They make life complex. In reality it is quite easy to make you own flash animation.</p>
<p class="MsoNormal"><strong><span style="color: #ff0000;">If you are looking for a customize flash animation, image slide show or any flash application you may </span><span style="color: #ff0000;">contact admin@imaginationdev.com</span></strong></p>
<p class="MsoNormal">I will be glad to help you out. If you need any advice you may post comments under this article.</p>
<p class="MsoNormal">There are number of types of flash animation that can be used in creating flash slide shows or animations.</p>
<p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"><!--[if !supportLists]--><span>-<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"> </span></span><!--[endif]--><strong>Flash 3d Slide Show (slideshow)</strong></p>
<p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"><!--[if !supportLists]--><span>-<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"> </span></span><!--[endif]--><strong>Flash Presentation Slide Show (slideshow)</strong></p>
<p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"><!--[if !supportLists]--><span>-<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"> </span></span><!--[endif]--><strong>Flash Banners Slide Show (slideshow)</strong></p>
<p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"><!--[if !supportLists]--><span>-<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"> </span></span><!--[endif]--><strong>Flash Image Galleries Slide Shows (slideshow)</strong></p>
<p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"><!--[if !supportLists]--><span>-<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"> </span></span><!--[endif]--><strong>Flash Text Slide Shows (slideshow)</strong></p>
<p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"><!--[if !supportLists]--><span>-<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"> </span></span><!--[endif]--><strong>Flash Interactive Slide Shows (slideshow)</strong></p>
<p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"><!--[if !supportLists]--><span>-<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"> </span></span><!--[endif]--><strong>Flash Image Slide Shows with Effects</strong></p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal">There are 2 basic styles to make flash image slide shows. Namely <strong>dynamic image or picture slide show and static image or picture slide show.</strong></p>
<p class="MsoNormal"><strong> </strong>Static flash picture slide show usually consists of some images that are internal to the flash and are embedded in the swf files. They have a benefit that there can be various customized animations that we can have in static image slide shows. The problem is they lack in security. There are numbers of flash de-compilers available which can extract the images and other people might use them.</p>
<p class="MsoNormal">If you want to have more security in terms of image copy rights its always better to use dynamic image or picture slideshow. Dynamic image slideshow are developed by loading <strong>external images</strong> at run time through <strong>XML. </strong><span> </span></p>
<p class="MsoNormal">In my flash picture slideshow tutorial I have used the dynamic approach also in flash action script 3 now its really easy to control animation and transition effects through tween classes.</p>
<p class="MsoNormal">Also by loading external we have a benefit that we can use flash xml image slideshow as a flash random image slideshow.</p>
<p class="MsoNormal"><strong><span style="color: #339966;"><span style="font-size: medium;">Here Goes the code for the Loading and Display and Tweening. I have also attached the source code along with all files at the end of the article.</span></span></strong><span style="font-size: medium;"><br />
</span></p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>////////////////////////////////////////////////////////////////////////
// Imports
////////////////////////////////////////////////////////////////////////</pre>
</div>
<p></code></div>
</div>
<p>import fl.transitions.*;<br />
import fl.transitions.easing.*;</p>
<p>////////////////////////////////////////////////////////////////////////<br />
// Variables Initiation and Declaration<br />
////////////////////////////////////////////////////////////////////////</p>
<p>var pic_prev_mc:MovieClip=new MovieClip();<br />
var pic_mc:MovieClip=new MovieClip();<br />
var picInitial_mc:MovieClip=new MovieClip();<br />
var xmlLoader:URLLoader = new URLLoader();<br />
var xmlData:XML;<br />
var thumbLoader:Loader;<br />
var index:int=0;<br />
var picArray:Array=new Array();<br />
var timer :Timer=new Timer(1000,4);<br />
var curr:int=1;<br />
var totalPictures:int;<br />
var flag:int=0;<br />
var bitmap:DisplayObject;<br />
var effect:Object=Photo;</p>
<p>////////////////////////////////////////////////////////////////////////<br />
// Function XMl Loading<br />
////////////////////////////////////////////////////////////////////////<br />
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);<br />
var httpHeader : URLRequestHeader = new URLRequestHeader(&#8221;pragma&#8221;,&#8221;no-cache&#8221;);<br />
var path:String=&#8221;Banner.xml&#8221;;<br />
xmlLoader.load(new URLRequest(path));</p>
<p>function LoadXML(e:Event):void {<br />
xmlData = new XML(e.target.data);<br />
stage.scaleMode = StageScaleMode.EXACT_FIT;<br />
stage.stageWidth= xmlData.Width;<br />
stage.stageHeight=xmlData.Height;<br />
getValues(xmlData);</p>
<p>}// end of Load XML<br />
xmlLoader.addEventListener(IOErrorEvent.IO_ERROR,funcError);<br />
function funcError(event:IOErrorEvent){<br />
trace(&#8221;Error occured in XML Loading&#8221;);<br />
}<br />
function getValues(input:XML) {<br />
var xmlCategoryList:XMLList = input.children();<br />
totalPictures=input.children().length();<br />
var item:XML;<br />
for each (item in xmlCategoryList) {</p>
<p>loadThumbs();<br />
}<br />
}<br />
////////////////////////////////////////////////////////////////////////<br />
// Function  loadThumbs<br />
////////////////////////////////////////////////////////////////////////<br />
function loadThumbs():void {<br />
thumbLoader = new Loader();<br />
thumbLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadThumbProgress);<br />
thumbLoader.contentLoaderInfo.addEventListener(Event.INIT, thumbLoaded);<br />
thumbLoader.load(new URLRequest(String(xmlData.path[index])));//access the thumbnails</p>
<p>function loadThumbProgress(e:ProgressEvent):void {<br />
}<br />
////////////////////////////////////////////////////////////////////////<br />
// Function  thumbloaded<br />
////////////////////////////////////////////////////////////////////////<br />
function thumbLoaded(e:Event):void {<br />
for(var i:int=0;i&lt;totalPictures;i++){;<br />
picArray[i]=xmlData.path[i];</p>
<p>}<br />
addChild(picInitial_mc);<br />
picInitial_mc.addChild(thumbLoader.content);<br />
bitmap=thumbLoader.content;<br />
}<br />
function xmlLoadFail(event:IOErrorEvent):void {<br />
trace(&#8221;error loading the XML&#8221;);<br />
}<br />
}<br />
////////////////////////////////////////////////////////////////////////<br />
// Function  Next Pic  Loading<br />
////////////////////////////////////////////////////////////////////////</p>
<p>function nextPicLoad(string:String) {<br />
thumbLoader = new Loader();<br />
thumbLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadThumbProgress);<br />
thumbLoader.contentLoaderInfo.addEventListener(Event.INIT, thumbLoaded);<br />
thumbLoader.load(new URLRequest(String(string)));</p>
<p>function thumbLoaded(e:Event):void {<br />
stage.addChild(thumbLoader.content);<br />
addChild(pic_mc);<br />
addChild(thumbLoader.content);<br />
pic_mc.addChild(thumbLoader.content);<br />
bitmap=thumbLoader.content;<br />
//Blinds, Fade, Iris, Photo, PixelDissolve, Rotate, Squeeze, Wipe, or Zoom.<br />
TransitionManager.start(pic_mc, {type:Fade, direction:Transition.IN, duration:1, easing:Regular.easeInOut});<br />
TransitionManager.start(pic_mc, {type:Wipe, direction:Transition.IN, duration:1, easing:Regular.easeIn});</p>
<p>}<br />
function loadThumbProgress(e:ProgressEvent):void {<br />
}</p>
<p>}</p>
<p>////////////////////////////////////////////////////////////////////////<br />
// Function  Pic Display<br />
////////////////////////////////////////////////////////////////////////</p>
<p>function picDisplay() {<br />
timer.start();<br />
timer.addEventListener(TimerEvent.TIMER_COMPLETE,funcTimer);<br />
function funcTimer(event:TimerEvent) {<br />
for(var k:int=0;k&lt;pic_mc.numChildren;k++){<br />
pic_mc.removeChildAt(k);</p>
<p>}<br />
if (flag==0) {<br />
flag=1;<br />
removeChild(picInitial_mc);<br />
} else {<br />
removeChild(pic_mc);<br />
}<br />
addChild(bitmap)<br />
nextPicLoad(picArray[curr]);<br />
curr++;</p>
<p>if (curr==totalPictures) {<br />
curr=0;<br />
}<br />
timer.reset();<br />
timer.start();<br />
}<br />
}<br />
picDisplay();<br />
stop();</p>
<p class="MsoNormal">
<p class="MsoNormal">I have attached the code for <strong>free flash image slideshow</strong>. you are free to use and modify the code the way you like.</p>
<p class="MsoNormal"><span style="color: #000080;"><strong>Kindly Let me know about your remarks if this article is being helpful in solving your problem.</strong></span></p>
<p class="MsoNormal"><strong><span style="color: #ff0000;">Download Sample Project </span>:</strong><a href="../../../../uploads/2008/07/loadimage.zip"> </a><a href="http://actionscript-blog.imaginationdev.com/samples/banner-slideshow/banner-slideshow.zip">Image Slide Show Source Code</a></p>
<p class="MsoNormal"><strong> A running sample can be viewed at the following link</strong></p>
<p class="MsoNormal"><a href="http://actionscript-blog.imaginationdev.com/samples/banner-slideshow/Banner.swf">http://actionscript-blog.imaginationdev.com/samples/banner-slideshow/Banner.swf</a></p>
]]></content:encoded>
			<wfw:commentRss>http://actionscript-blog.imaginationdev.com/21/flash-xml-image-slide-show-action-script-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flip Horizontal Vertical Display Object MovieClip Flash Action Script</title>
		<link>http://actionscript-blog.imaginationdev.com/22/flip-horizontal-vertical-display-object-movieclip-action-script-flash/</link>
		<comments>http://actionscript-blog.imaginationdev.com/22/flip-horizontal-vertical-display-object-movieclip-action-script-flash/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 20:50:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Action Script 3.0]]></category>

		<category><![CDATA[Action Script Development]]></category>

		<category><![CDATA[Action Script 3]]></category>

		<category><![CDATA[action script filp movie clip horizontal]]></category>

		<category><![CDATA[action script filp movie clip vertical]]></category>

		<category><![CDATA[action script filp movie clip verticle horizontal]]></category>

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

		<category><![CDATA[as 3 flip diplay object flash horizontal]]></category>

		<category><![CDATA[as3 flip diplay object flash vertical]]></category>

		<category><![CDATA[as3 flip horizontal movie clip]]></category>

		<category><![CDATA[as3 flip movie clip]]></category>

		<category><![CDATA[flash action script 3]]></category>

		<category><![CDATA[flash action script 3 mirror movie clip]]></category>

		<category><![CDATA[flash action script filp movie clip verticle horizontal]]></category>

		<category><![CDATA[Flash actionsript 3]]></category>

		<category><![CDATA[flash filp movie clip horizontal]]></category>

		<category><![CDATA[flash filp movie clip vertical horizontal]]></category>

		<category><![CDATA[flash filp movie clip verticle]]></category>

		<category><![CDATA[flash filp movie clip verticle horizontal]]></category>

		<category><![CDATA[flip horizontal]]></category>

		<category><![CDATA[flip horizontal matrix action script]]></category>

		<category><![CDATA[flip horizontal matrix actionscript]]></category>

		<category><![CDATA[flip verticle]]></category>

		<category><![CDATA[flip verticle matrix action script]]></category>

		<category><![CDATA[flip verticle matrix actionscript]]></category>

		<category><![CDATA[X action script filp movie clip display object vertical]]></category>

		<category><![CDATA[X flash action script filp movie clip vertical horizont]]></category>

		<guid isPermaLink="false">http://actionscript-blog.imaginationdev.com/?p=22</guid>
		<description><![CDATA[Flash action script tutorial on how to flip horizontally and vertically  movie clip and display objects in flash action script 3]]></description>
			<content:encoded><![CDATA[<p>Hi, Today i came across a problem while using code from snipplr article for <strong>Flipping Display Objects and MovieClip in Flash Action Script 3</strong>.  Problem was i was using a button to <strong>flip the movieclip horizontal and vertical</strong>. If i clicked the button twice it use to change its location.  I have tweak the code to check if the movie clip is already mirrored or flipped horizontal or vertically and inverse the previous effect.</p>
<p><strong>Flipping or Mirror Movie Clip and display object</strong> is a common requirement these days. Flash action script 3 geom.matrix class has solved most of the problems. Though its a bit tricky to use them. Any further questions let me know.  Thank you all for supporting the blog.</p>
<p><span style="color: #008000;"><strong>Here Goes the code to flip Mirror action script 3 display objects and movie clips</strong></span></p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>function flipHorizontal(dsp:DisplayObject):void
{
	var matrix:Matrix = dsp.transform.matrix;
	matrix.transformPoint(new Point(dsp.width/2,dsp.height/2));
	if(matrix.a&gt;0){
		matrix.a=-1*matrix.a;
		matrix.tx=dsp.width+dsp.x;
	}
	else
	{
		matrix.a=-1*matrix.a;
		matrix.tx=dsp.x-dsp.width;
	}
	dsp.transform.matrix=matrix;
}

function flipVertical(dsp:DisplayObject):void
{
	var matrix:Matrix = dsp.transform.matrix;
	matrix.transformPoint(new Point(dsp.width/2,dsp.height/2));
	if(matrix.d&gt;0){
		matrix.d=-1*matrix.d;
		matrix.ty=dsp.y+dsp.height;
	}
	else
	{
		matrix.d=-1*matrix.d;
		matrix.ty=dsp.y-dsp.height;
	}
	dsp.transform.matrix=matrix;
}</pre>
</div>
<p></code></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://actionscript-blog.imaginationdev.com/22/flip-horizontal-vertical-display-object-movieclip-action-script-flash/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Load External Image and SWF Flash Action Script 3</title>
		<link>http://actionscript-blog.imaginationdev.com/19/load-external-image-and-swf-flash-action-script-3/</link>
		<comments>http://actionscript-blog.imaginationdev.com/19/load-external-image-and-swf-flash-action-script-3/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 21:51:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Action Script 3.0]]></category>

		<category><![CDATA[Action Script Development]]></category>

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

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

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

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

		<category><![CDATA[as3 external image load]]></category>

		<category><![CDATA[as3 external swf loading]]></category>

		<category><![CDATA[dynamic image loading action script]]></category>

		<category><![CDATA[dynamic loading image into flash]]></category>

		<category><![CDATA[external image loading flash action script 3]]></category>

		<category><![CDATA[flash action script 3]]></category>

		<category><![CDATA[Flash actionsript 3]]></category>

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

		<category><![CDATA[load ecternal image code]]></category>

		<category><![CDATA[load external image flash]]></category>

		<category><![CDATA[load external image preloader]]></category>

		<category><![CDATA[load external image using action script 3]]></category>

		<category><![CDATA[load image action script 3]]></category>

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

		<category><![CDATA[load image using preloader]]></category>

		<category><![CDATA[load swf action script 3]]></category>

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

		<category><![CDATA[loading external images class]]></category>

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

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

		<guid isPermaLink="false">http://actionscript-blog.imaginationdev.com/?p=19</guid>
		<description><![CDATA[Flash action script tutorial on how to Load External Image and SWF files using flash action script 3 API. Also how to create a preloader for external loading of images.]]></description>
			<content:encoded><![CDATA[<p>Hi, every one here goes another article. I will sure come up with flash action script 3 MP3 player Part 2 soon.  <span style="color: #993366;"><strong>Let us focus on loading external images in flash action script 3.</strong></span> For the beginners its a huge problem to <strong>load external images and swf file into a flash Movie clip and and flash action script 3.</strong> Some time people consider it hard to attach a pre loader on the loading external image in flash action script 3. I was working on an flash image gallery project and came across the same problem. What i was planning to have a <strong>flash action script 3 class </strong>to do my <strong>external image loading. </strong>I thought of an idea to make this class a reusable utility to <strong>load external image in flash action script 3</strong> and built in support for a preloader.  I have defined a class named ImageContainer. Image Container class is inherited from MovieClip class. This class support <strong>dynamic loading of external image and swf file into flash</strong>.  In the attached sample i have loaded a <strong>JPEG file</strong> and a <strong>SWF file dynamically into flash</strong>.<br />
<strong><span style="color: #008000;">Here goes the code for the Image Container class.</span></strong></p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>package image{

import flash.display.MovieClip;
import flash.events.ProgressEvent;
import flash.events.Event;
import flash.display.Loader;
import flash.net.URLRequest;
import fl.transitions.*;
import fl.transitions.easing.*;

public class imageContainer extends MovieClip {
public var imageURL:String;
public var urlRequest:URLRequest;
public var imageLoader:Loader;
public var imageWidth:Number;
public var imageHeight:Number;
public var preLoader:Loader;
var mcImage:MovieClip=new MovieClip();
public function imageContainer(Imagewidth:Number,Imageheight:Number,url:String,path:String) {
preLoader=new Loader();
preLoader.load(new URLRequest(path));
preLoader.scaleX=2;
preLoader.scaleY=2;
preLoader.x=Imagewidth/2-preLoader.width/2;
preLoader.y=Imageheight/2-preLoader.height/2;
addChild(preLoader);

imageURL=url;
imageWidth=Imagewidth;
imageHeight=Imageheight;
loadThumb(url);
}
public function loadThumb(url:String) {
urlRequest=new URLRequest(url);
imageLoader=new Loader();
imageLoader.load(urlRequest);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,funcComplete);

function funcComplete(e:Event) {
removeChild(preLoader);
trace("Successfully Loaded");
imageLoader.content.width=imageWidth;
imageLoader.content.height=imageHeight;
mcImage.addChild(imageLoader.content);
TransitionManager.start(mcImage,{type:Fade, direction:Transition.IN, duration:3, easing:Regular.easeIn});
addChild(mcImage);
}
}
}
}</pre>
</div>
<p></code></div>
</div>
<p>I have applied transition effect after loading of external image is completed. This class will help you save time in loading external images and applying pre loader to Flash action script 3.<br />
<strong><span><strong><span style="color: #008000;">Here goes the code for Using the Image Container class.</span></strong></span></strong></p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>import image.imageContainer;
//Loading SWF
var im:imageContainer=new imageContainer(200,200,"001.swf","loader.swf");
addChild(im)
//Loading Image
var im1:imageContainer=new imageContainer(200,200,"Sunset.jpg","loader.swf");
var child = addChild(im1)
child.x = 300;</pre>
</div>
<p></code></div>
</div>
<p class="MsoNormal"><span style="color: #000080;"><strong>Kindly Let me know about your remarks if this article is being helpful in solving your problem.</strong></span></p>
<p class="MsoNormal"><strong><span style="color: #ff0000;">Download Sample Project </span>: </strong><a href="http://actionscript-blog.imaginationdev.com/wp-content/uploads/2008/07/loadimage.zip">Load Image Source Code </a></p>
<p class="MsoNormal"><strong> A running sample can be viewed at the following link</strong></p>
<p class="MsoNormal"><a title="Load Image Sample" href="http://www.imaginationdev.com/actionscript-blog/samples/LoadImage/LoadImage.swf" target="_blank">www.imaginationdev.com/actionscript-blog/samples/LoadImage/LoadImage.swf </a></p>
]]></content:encoded>
			<wfw:commentRss>http://actionscript-blog.imaginationdev.com/19/load-external-image-and-swf-flash-action-script-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Vote For New Action Script 3 Article and Tutorial</title>
		<link>http://actionscript-blog.imaginationdev.com/18/vote-for-new-action-script-3-article-and-tutorial/</link>
		<comments>http://actionscript-blog.imaginationdev.com/18/vote-for-new-action-script-3-article-and-tutorial/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 22:37:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Action Script 3.0]]></category>

		<category><![CDATA[Action Script Development]]></category>

		<category><![CDATA[Flash Communication With C#]]></category>

		<category><![CDATA[Flash communication with Java script.]]></category>

		<category><![CDATA[Flash Communication With JAVA Sockets Programming]]></category>

		<category><![CDATA[Flash Communication With PHP]]></category>

		<category><![CDATA[Flash communication with VB.net]]></category>

		<category><![CDATA[flash component development basics]]></category>

		<category><![CDATA[Flash Drawing Board Sample]]></category>

		<category><![CDATA[Flash MP3 player Part 2]]></category>

		<category><![CDATA[flash xml action script 3 image gallery]]></category>

		<category><![CDATA[FLV player using flash action script 3]]></category>

		<category><![CDATA[Generating PDF using flash and C#]]></category>

		<guid isPermaLink="false">http://actionscript-blog.imaginationdev.com/?p=18</guid>
		<description><![CDATA[Hi, Every one due to some time constraints i am unable to post articles all at a time, as i have a lot of articles and samples in my mind . I am listing down the articles. I would ask for votes which article to write first
  funny but i guess its a good [...]]]></description>
			<content:encoded><![CDATA[<p>Hi, Every one due to some time constraints i am unable to post articles all at a time, as i have a lot of articles and samples in my mind . I am listing down the articles. <strong>I would ask for votes which article to write first</strong></p>
<p> <img src='http://actionscript-blog.imaginationdev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> funny but i guess its a good way to communicate</p>
<p><strong>1- FLV player using flash action script 3<br />
</strong></p>
<p><strong>2- Flash MP3 player Part 2 </strong></p>
<p><strong>3- Flash Drawing Board Sample </strong></p>
<p><strong>4- Flash Communication With C#</strong></p>
<p><strong>5- Flash Communication With PHP</strong></p>
<p><strong>6- Flash Communication With JAVA Sockets Programming</strong></p>
<p><strong>7- Flash communication with VB.net</strong></p>
<p><strong>8- Generating PDF using flash and C#</strong></p>
<p><strong>9- Flash communication with Java script.</strong></p>
<p><strong>10- flash xml action script 3 image gallery</strong></p>
<p><strong>11- flash component development basics</strong></p>
<p>This is what all in my mind if you have others in MIND . Also I might add article for flash media server.</p>
<p>If you have any idea in mind, or any solution that you want to share you are well come. Also If you have any thing you need to ask or need help you may leave comments. I will definitely reply Back.</p>
<p>Article with maximum votes will be Written on priority basis.</p>
<p>Thanks All</p>
]]></content:encoded>
			<wfw:commentRss>http://actionscript-blog.imaginationdev.com/18/vote-for-new-action-script-3-article-and-tutorial/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Action Script 3 MovieClip MouseEvent CLICK Problem</title>
		<link>http://actionscript-blog.imaginationdev.com/17/action-script-3-movieclip-mouseevent-click-problem/</link>
		<comments>http://actionscript-blog.imaginationdev.com/17/action-script-3-movieclip-mouseevent-click-problem/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 22:23:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Action Script 3.0]]></category>

		<category><![CDATA[Action Script Development]]></category>

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

		<category><![CDATA[action script]]></category>

		<category><![CDATA[Action Script 3]]></category>

		<category><![CDATA[action script 3 article]]></category>

		<category><![CDATA[action script 3 bug]]></category>

		<category><![CDATA[Action script 3 problem]]></category>

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

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

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

		<category><![CDATA[flash action script 3]]></category>

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

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

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

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

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

		<guid isPermaLink="false">http://actionscript-blog.imaginationdev.com/?p=17</guid>
		<description><![CDATA[Hi, All Thank you Guys for Supporting my articles. Today i came across a very strange behaviour of flash action script 3 click MouseEvent.
I had a custom class lets say

Public class CustomMovieClip extends MovieClip {
public function CustomMovieClip()
{
     addChild(new DisplayObject()); //Suppose its name is instance123
}
}
Now after that if i add a reference [...]]]></description>
			<content:encoded><![CDATA[<p>Hi, All Thank you Guys for Supporting my articles. Today i came across a very strange behaviour of flash action script 3 click MouseEvent.</p>
<p><strong>I had a custom class lets say</strong></p>
<pre>
Public class CustomMovieClip extends MovieClip {
public function CustomMovieClip()
{
     addChild(new DisplayObject()); //Suppose its name is <strong>instance123</strong>
}
}</pre>
<p><strong>Now after that if i add a reference of this class on Lets suppose stage </strong></p>
<pre>
var mc = stage.addChild(new CustomMovieClip());
mc.addEventListener(MouseEvent.Click,clicker);
trace(mc.name); 

//Suppose its name assigned is <strong>instance124</strong>
function clicker(event:MouseEvent)
{
trace(evt.target.name); //Here it will out put <strong>instance123,
                            </strong>//instead of instance124
}</pre>
<p>You see i have applied event handler on the object of CustomMovieClip but its fired for the child. Here if i need to Get the state of the CustomMovieClip object i need to change the following</p>
<pre>function clicker(event:MouseEvent)</pre>
<pre>{</pre>
<pre>    trace(evt.target.parent.name); //Here it will out put <strong>instance124, </strong>
                                   //now its the right out put</pre>
<pre>}</pre>
<p><strong>if you have found this posting help full and if you have further explanation to why this happens Kindly share it with all here.</strong></p>
<p>Do write comments, this will help me motivated to right more and more articles on Action script 3.</p>
]]></content:encoded>
			<wfw:commentRss>http://actionscript-blog.imaginationdev.com/17/action-script-3-movieclip-mouseevent-click-problem/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flash Action Script 3 MP3 Player Part 1</title>
		<link>http://actionscript-blog.imaginationdev.com/13/flash-action-script-3-mp3-player/</link>
		<comments>http://actionscript-blog.imaginationdev.com/13/flash-action-script-3-mp3-player/#comments</comments>
		<pubDate>Thu, 22 May 2008 10:31:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Action Script 3.0]]></category>

		<category><![CDATA[Action Script Development]]></category>

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

		<category><![CDATA[Action Script 3]]></category>

		<category><![CDATA[action script 3 flash player]]></category>

		<category><![CDATA[Action Script 3 MP3 Player]]></category>

		<category><![CDATA[actions script 3 media player]]></category>

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

		<category><![CDATA[actionscript3 programming]]></category>

		<category><![CDATA[best flash mp3 player]]></category>

		<category><![CDATA[build a flash mp3 player]]></category>

		<category><![CDATA[custom flash mp3 player]]></category>

		<category><![CDATA[Flash Action Script 3 MP3 Player]]></category>

		<category><![CDATA[flash based mp3 player]]></category>

		<category><![CDATA[Flash Mp3 Player]]></category>

		<category><![CDATA[flash mp3 player code]]></category>

		<category><![CDATA[flash mp3 player software]]></category>

		<category><![CDATA[flash mp3 player website]]></category>

		<category><![CDATA[free flash mp3 player]]></category>

		<category><![CDATA[media player]]></category>

		<category><![CDATA[MP3 player]]></category>

		<category><![CDATA[mp3 player for flash]]></category>

		<category><![CDATA[mp3 player with flash]]></category>

		<category><![CDATA[online flash mp3 player]]></category>

		<category><![CDATA[Sound Class optimization]]></category>

		<category><![CDATA[sound programming action script 3]]></category>

		<category><![CDATA[top flash mp3 player]]></category>

		<category><![CDATA[web flash mp3 player]]></category>

		<guid isPermaLink="false">http://actionscript-blog.imaginationdev.com/?p=13</guid>
		<description><![CDATA[Flash action script as3 tutorial on how to create an xml play list based mp3 player using flash mp3 API.]]></description>
			<content:encoded><![CDATA[<p align="justify">Here goes <strong>Flash Action Script 3 MP3 Player</strong> - <strong>Part 1</strong>. Need Your comments and support on the articles.</p>
<p align="justify">I am writing this first version of  <strong>Flash Action Script 3 MP3 </strong>for beginners so that they can have an idea of Flash Action Script 3 Sound Classes. Also this code uses memory optimization techniques to reduce memory leaks.</p>
<p align="justify">To Learn More About Memory Optimization read my previous post</p>
<p align="justify"><a href="http://actionscript-blog.imaginationdev.com/Memory-Optimization-Flash-Action-Script-3" title="Memory Optimization Flash Action Script 3" target="_blank">http://actionscript-blog.imaginationdev.com/Memory-Optimization-Flash-Action-Script-3</a></p>
<p align="justify"><strong>Flash Action Script 3 MP3</strong> <strong>Player</strong> can be developed in 2 ways. <strong>1-</strong> Songs are played once they are completely downloaded on the local machine, Part 1 of my <strong>Flash Action Script 3 MP3 Player </strong>uses this techniques. this approach is suitable when developing a desktop application. <strong>2-</strong> Songs are buffered and streamed from the server and played simultaneously.  This type of approach is common for <strong>Online</strong> <strong>Flash Action Script 3 MP3 Player. </strong>Part 2 of this article series will cover the 2nd methodology.</p>
<p align="justify">Building a <strong>Flash Action Script 3 MP3 Player </strong>is really easy using Flash Action Script 3 classes. Once you have the concepts of Sound class, SoundChannel class and Timer class in Flash Action Script 3 you are ready to develop a Media Player in Flash Action Script 3. In case you need guidance and help in the above mentioned classes you are welcome to leave comments and i will respond as soon as possible.</p>
<p align="justify">This might not be the best <strong>Flash Action Script 3 MP3 Player. </strong>This sure will guide you how to develop a <strong>Flash Action Script 3 MP3 Player using </strong>flash action script. There are number of flash media players available on the internet but very few i saw focussed on the fact that action script sound class has some problems when optimizing memory space. So i thought to write one sample of my own.</p>
<p align="justify">This flash MP3 player is easily customizable and reusable. In coming future i plan to write a Flash MP3 Player Component using Action Script3. Hopefully that article will also cover the basis of creating a flash component.</p>
<p align="justify">You can use the <strong>flash action script 3 Mp3 player code</strong> to build your own customized <strong>Flash Action Script 3 MP3 Players. </strong>Basic idea will always remain the same.</p>
<p align="justify"><font color="#000080"><strong>Flash Action Script 3 MP3 </strong><strong>Player development starts with the code for loading XML and inserting data in the play list.</strong></font></p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>
/////////////////////////////////////////////////////////////////
//Loading XML
/////////////////////////////////////////////////////////////////
var xmlData:XML; var xmlLoader:URLLoader = new URLLoader();xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest(&quot;playlist.xml&quot;));

function LoadXML(e:Event):void {
         trace(LoadXML); xmlData = new XML(e.target.data);
         function getValues(input:XML) {
              var xmlCategoryList:XMLList = input.children(); var item:XML;var intCount:int = 0;

              for each (item in xmlCategoryList) {
                   playList.addItem({label:item.title, data:item.url}); intCount = intCount + 1;
             }
         }//end of get Values Function

         getValues(xmlData);
}// end of Load XML</pre>
</div>
<p></code></div>
</div>
<p align="justify"><strong><font color="#000080">After that we will wait until user clicks on any song in play list.  For handling play list event we will write the following code.</font></strong></p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>
playList.addEventListener(Event.CHANGE, playListChangeHandler);

function playListChangeHandler(event:Event) {
           if (flagSoundChannel==1) {
                   soundChannel.stop();
           } else if (flagSoundChannel==0) {
                   flagSoundChannel=1;
          } 

          playSound(event.target.selectedItem.data);timeSlider.value=0;
}// end of change Handler</pre>
</div>
<p></code></div>
</div>
<p align="justify"><font color="#000080"><strong>Above code calls another important function playSound. This method loads the new sound in the sound Object.</strong></font></p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>
function playSound(path) {
           songPath.url = path;
           if(playerObject.sound!=null)
                   delete playerObject.sound;
          playerObject.sound = new Sound();
          addSoundEvents();
          playerObject.sound.load(songPath);
}</pre>
</div>
<p></code></div>
</div>
<p align="justify"><font color="#000080"><strong>Above code requires sound events to be handled before a new sound object is created. </strong>If you focus on the <strong>delete playerObject.sound;</strong> statement, this deletes the previous allocation of memory for the sound object. If we don&#8217;t do this a lot of memory will leak and eventually application will crash.</font></p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>/////////////////////////////////////////////////////////////////
//Sound Loading Event Handler Function
/////////////////////////////////////////////////////////////////

function addSoundEvents():void
{
	playerObject.sound.addEventListener(Event.COMPLETE, funcSoundLoaded);
	playerObject.sound.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
	playerObject.sound.addEventListener(ProgressEvent.PROGRESS,funcOnLoadProgress);
}

function funcSoundLoaded(event:Event) {
	var soundObject:Sound = event.target as Sound;
	var totalSoundDuration:Number;
	soundChannel=soundObject.play();
	totalSoundDuration=(soundObject.length/1000)/(60);
	totalSoundDuration=Math.floor((totalSoundDuration*100));
	totalSoundDuration=totalSoundDuration/100;
	timeSlider.maximum=(soundObject.length/1000);
	sliderDivisionValue=totalSoundDuration;
	fileTimeInSec = Math.floor(playerObject.sound.length/1000);
	secTimer.start();
}//end of Function Loaded 

function funcOnLoadProgress(event:ProgressEvent):void {
	var loadedPct:uint =Math.round(100 * (event.bytesLoaded / event.bytesTotal));
	trace("The playerObject.sound is " + loadedPct + "% loaded.");
}

function onIOError(e:IOErrorEvent) {
	trace("The playerObject.sound can not be Loaded"+ e.text);
}</pre>
</div>
<p></code></div>
</div>
<p><font color="#000080"><strong>Above is code implementation of sound event handlers. </strong>Lastly we will add Timers and GUI element event handlers.</font></p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>
/////////////////////////////////////////////////////////////////
//Control Handlers UIDesign
/////////////////////////////////////////////////////////////////

btnStop.addEventListener(MouseEvent.CLICK,funcStop);
btnPause.addEventListener(MouseEvent.CLICK,funcPause);
btnPlay.addEventListener(MouseEvent.CLICK,funcPlay);
btnForward.addEventListener(MouseEvent.CLICK,funcForward);
btnBack.addEventListener(MouseEvent.CLICK,funcReverse);
soundChannel.addEventListener(Event.SOUND_COMPLETE, funcComplete);

function funcComplete(event:Event) {
	soundChannel.stop();
	timeSlider.value=0;
	currPosition=0;
}

function funcStop(event:Event) {
	secTimer.reset();
	timeSlider.value=0;
	currPosition=0;
	soundChannel.stop();
	flagSoundChannel=0;
}

function funcPause(event:Event) {
	secTimer.stop();
	currPosition= soundChannel.position;
	soundChannel.stop();
	btnPlay.visible=true;
	btnPause.visible=false;
}

function funcPlay(event:Event) {
	soundChannel.stop();
	soundChannel=playerObject.sound.play(currPosition);
	btnPlay.visible=false;
	btnPause.visible=true;
	secTimer.start();
}

function funcForward(event:Event) {
	if (soundChannel.position+forwardDuration&#60;=playerObject.sound.bytesTotal) {
		timeSlider.value+=forwardDuration/1000;
		soundChannel.stop();
		soundChannel=playerObject.sound.play(soundChannel.position+forwardDuration);
	}
	else
	{
		timeSlider.value=0;
		currPosition=0;
		soundChannel.stop();
		flagSoundChannel=0;
	}
}

function funcReverse(event:Event) {
	if (soundChannel.position-forwardDuration>0) {
		timeSlider.value-=forwardDuration/1000;
		soundChannel.stop();
		soundChannel=playerObject.sound.play(soundChannel.position-forwardDuration);
	}
	else
	{
		timeSlider.value=0;
		currPosition=0;
		soundChannel.stop();
		flagSoundChannel=0;
	}
}

/////////////////////////////////////////////////////////////////
//Control Handlers Sliders
/////////////////////////////////////////////////////////////////

timeSlider.addEventListener(SliderEvent.THUMB_PRESS,sliderPressed);
timeSlider.addEventListener(SliderEvent.THUMB_RELEASE,sliderReleased);
timeSlider.addEventListener(SliderEvent.CHANGE,sliderChangeHandler);

timeSlider.liveDragging =true;
function sliderChangeHandler(event:SliderEvent) {
	secTimer.stop();
	soundChannel.stop();
	soundChannel=playerObject.sound.play(event.target.value*1000);
	secTimer.start();
}

function sliderPressed(event:SliderEvent) {
}

function sliderReleased(event:SliderEvent) {

	secTimer.stop();
	soundChannel.stop();
	soundChannel=playerObject.sound.play(event.target.value*1000);
	secTimer.start();

}

/////////////////////////////////////////////////////////////////
//Control Handlers Timers
/////////////////////////////////////////////////////////////////

secTimer.addEventListener(TimerEvent.TIMER, onTick);
secTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);

function onTick(event:TimerEvent):void {
	trace("Timer is running");
	timeSlider.value+=1;
}

function onTimerComplete(event:TimerEvent):void {
	trace("Time's Up!");
}</pre>
</div>
<p></code></div>
</div>
<p class="MsoNormal"><strong> For Further details on voice control and sound buffering you may contact me. I will soon be writing part 2 of the flash MP3 Player series with voice control and Sound Buffering. </strong></p>
<p class="MsoNormal"><font color="#000080"><strong>Kindly Let me know about your remarks if this article is being helpful in solving your problem.</strong></font></p>
<p class="MsoNormal"><strong><font color="#ff0000">Download Sample Project  </font>: </strong><a href="http://actionscript-blog.imaginationdev.com/wp-content/uploads/2008/05/mp3-player.zip" title="Flash MP3 Player Using Action Script 3">Flash MP3 Player Using Action Script 3</a></p>
<p class="MsoNormal"><strong> A running sample can be viewed at the following link</strong></p>
<p class="MsoNormal"><a href="http://www.imaginationdev.com/actionscript-blog/samples/mp3-player/play.html" target="_blank">www.imaginationdev.com/actionscript-blog/samples/mp3-player/play.html </a></p>
<p class="MsoNormal">&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://actionscript-blog.imaginationdev.com/13/flash-action-script-3-mp3-player/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Memory Optimization Flash Action Script 3</title>
		<link>http://actionscript-blog.imaginationdev.com/12/memory-optimization-flash-action-script-3/</link>
		<comments>http://actionscript-blog.imaginationdev.com/12/memory-optimization-flash-action-script-3/#comments</comments>
		<pubDate>Wed, 21 May 2008 20:36:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Action Script 3.0]]></category>

		<category><![CDATA[Action Script Development]]></category>

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

		<category><![CDATA[Action Script 3]]></category>

		<category><![CDATA[actionscript 3 memory leak and optimization]]></category>

		<category><![CDATA[flash action script 3]]></category>

		<category><![CDATA[Flash actionsript 3]]></category>

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

		<category><![CDATA[Flash Mp3 Player]]></category>

		<category><![CDATA[memory leak sound object flash]]></category>

		<category><![CDATA[memory optimization]]></category>

		<category><![CDATA[memory optimization flash actionscript]]></category>

		<category><![CDATA[sound object]]></category>

		<category><![CDATA[Sound object flash optimization]]></category>

		<guid isPermaLink="false">http://actionscript-blog.imaginationdev.com/?p=12</guid>
		<description><![CDATA[Flash action script article on how to have Memory Optimization done in flash Action Script 3]]></description>
			<content:encoded><![CDATA[<p>Hi, Every one here is another important article. Which i see really few have discussed, thats is memory optimization in Flash Action Script 3.  After all improvements still garbage collection is a bit slower i think. Or I guess there is no garbage collection. For example if i declare  <strong> var sound:Sound=new Sound();</strong>  now if i use new keyword to allocate memory.  There is no way to de-allocate memory. Now if i call following line  <strong> sound=new Sound();</strong>  This will cause a new memory to be allocated to the Sound Object and the old memory refrence will be lost but memmory will reside untill the end of applicatio.  Now consider a Flash Media Player with a play list and each time a Sound object is Allocated new memory, than you can imagine the memory leak.  Its strange there is no way to deallocate a memory after it is allocated by &quot;new&quot; keyword.  Although there is delete keyword in flash actionscript 3. For example if i write  <strong>delete sound;</strong>  This statement will give Error that &quot;1189: Attempt to delete the fixed property sound.  Only dynamically defined properties can be deleted.&quot;  Now sound object although it is dynamically created but it can&#8217;t be destroyed.  Solution that i found is to create an ParentObject of object class and than create the sound object as a dynamic property of ParentObject.  1- Declare parent object  <strong> var playerObject:Object = new Object();</strong>  2- Create the sound object as dynamic property of this object.  <strong> playerObject.sound = new Sound(); </strong>  3- Delete the memory allocated at the end  <strong>delete playerObject.sound;</strong>  This time delete case will deallocate memory allocated to the dynamic property      &quot;playerObject.sound&quot; This strategy can be used any where, to avoid the memory leaks in flash actionscript 3 applications.  I have used the Sound object example as i am now working on an article for the Flash MP3 Player. And i came across this problem during its development. For Questions You can post your feed back I would appreciate your comments.  Your support will encourage me to post more and more aricles.  If you are looking for live assistance on any projects you are well come. I plan to start an Action Script 3 training course for beginners. Those of you intrested may contact.</p>
]]></content:encoded>
			<wfw:commentRss>http://actionscript-blog.imaginationdev.com/12/memory-optimization-flash-action-script-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Save JPG JPEG PNG BMP Image Action Script 3</title>
		<link>http://actionscript-blog.imaginationdev.com/5/save-jpg-jpeg-png-bmp-image-action-script-3/</link>
		<comments>http://actionscript-blog.imaginationdev.com/5/save-jpg-jpeg-png-bmp-image-action-script-3/#comments</comments>
		<pubDate>Sun, 04 May 2008 20:27:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Action Script 3.0]]></category>

		<category><![CDATA[Action Script Development]]></category>

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

		<category><![CDATA[300 DPI]]></category>

		<category><![CDATA[Action Script 3]]></category>

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

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

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

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

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

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

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

		<category><![CDATA[Save 300 DPI Image Flash]]></category>

		<category><![CDATA[save BMP actionscript]]></category>

		<category><![CDATA[save BMP actionscript 3]]></category>

		<category><![CDATA[Save Image Flash ActionScript]]></category>

		<category><![CDATA[Save Image PHP and Action script]]></category>

		<category><![CDATA[Save Image PHP and Flash]]></category>

		<category><![CDATA[save JPG actionscript]]></category>

		<category><![CDATA[save JPG actionscript 3]]></category>

		<category><![CDATA[save PNG actionscript]]></category>

		<category><![CDATA[save PNG actionscript 3]]></category>

		<category><![CDATA[save PNG BMP JPEG JPG actionscript]]></category>

		<guid isPermaLink="false">http://actionscript-blog.imaginationdev.com/?p=5</guid>
		<description><![CDATA[Flash tutorial to save jpeg bmp and png image using flash action script 3 api and php]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal"><strong>Well finally i got time to Bring together a sample project. Kindly Let me know about your comments if this article is being helpful in solving your problem.<span style="color: #000080;"> </span></strong></p>
<h4><strong><span style="color: #000080;">Kindly do write your comments on this post. This will encourage me to write more and more articles for action script community</span>.</strong></h4>
<p class="MsoNormal"><strong> </strong> I have recently been working on an online Drawing Board application. We needed to save the flash movie as an Image in JPEGEncoder, PNGEncoder and BMPEncoder. I searched internet i got a lot of help but it was all dispersed on multiple site also i needed to save the <strong>JPEG, PNG, BMP</strong> in<strong> 300 dpi</strong> through flash action script.  On the internet i found 2 ways to save the flash movie to any Image format such as JPEG, PNG, BMP.</p>
<p class="MsoNormal"><strong>1-</strong> Use the BitmapData class in action script 2/3 and get the data in string format that is basically value of each  pixel and send the data 2 PHP file on the server. PHP file would prepare the header of the required image format and save the JPEG, PNG, BMP on the server as well and than at last when JPEG, PNG, BMP is saved than prompt user to download JPEG, PNG, BMP on their PC.  This  method had a major flaw that when data was very large in case of Bitmap image this method becomes really slow and some time script gives error on the browser.</p>
<p>Such Kind of solution is available on the following link  http://www.quasimondo.com/archives/000645.php</p>
<p>Also i have attached the files that i downloaded from that website for the ease. The problem was i had to change DPI but PHP code was not that understandable.   This solution is recommendable when using action script 2, as action script 2 does not have that much support for images.</p>
<p><strong>2- </strong>Now for <strong>action script 3</strong>, Ah i love Action script 3 as always coming to rescue. I found classes written in Action Script 3.  I have forgot the direct links from where i downloaded those files (As there were multiple locations).  In this solution all the code is in flash action script.</p>
<p>There are 4 major classes BitmapData, JPEGEncoder, PNGEncoder and BMPEncoder. These classes prepare the header and every thing in action script and Post the Bytes as Array to PHP webpage.  Now from here there are 2 ways   One is PHP just temporary save file and prompt user to save or open the file.  This had problems when a flash page was called from Actions script a new window in the browser open but if there is a Pop up blocker than no save dialog use to appear, as the page that was called the Popup blocker blocks it. The solution to solve this problem is use the<strong> &#8220;_self&#8221;</strong> parameter instead of <strong>&#8220;_blank&#8221;</strong>.  This again had problem with internet explorer 6, but worked well with explorer 7 and Firefox. Problem was the the session expired on IE 6 once the <strong>JPEG, PNG, BMP</strong> image is saved on the server.  This  cause the save method just to run once on the browser instance than every time to make it work we needed to refresh browser and that was not acceptable in our  solution.</p>
<p>Other way around is that, save the file on the server and i used a <strong>Timer</strong> in <strong>Action script </strong>which will continuously check as the file is completely saved on the server. If file is completely saved on the server than flash Call the download function of the <strong>FileRefrence</strong> class. This function downloads the file on user desktop. Now there is our choice weather to delete the file from server or to keep it on the server as well. This method is excellent as no browser or pop up blocker problem.</p>
<p class="MsoNormal">I have made changes in the following classes: <strong> <a title="JPEGEncoder" href="http://actionscript-blog.imaginationdev.com/wp-content/uploads/2008/05/jpgencoder.as">JPEGEncoder</a></strong><strong>, <a title="PNGEncoder" href="http://actionscript-blog.imaginationdev.com/wp-content/uploads/2008/05/pngencoder.as">PNGEncoder</a></strong><strong> and <a title="BMPEncoder" href="http://actionscript-blog.imaginationdev.com/wp-content/uploads/2008/05/bmpencoder.as">BMPEncoder</a></strong><strong>. </strong>I have commented the section for the DPI settings in the classes you may look at the classes provided.</p>
<p class="MsoNormal">To use Above files make changes in the package declaration. To adjust to your older&#8217;s hierarchy.</p>
<p class="MsoNormal"><strong>Following is the code Accessing the above classes and Using the FileReference class to download the file on personal computer.</strong></p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>&#60;pre>
////////////////////////////////////////////////////////////////////////////
//Imports 

flash.display.Stage;
import flash.display.Sprite;
import flash.display.MovieClip;
import com.adobe.images.JPGEncoder;
import com.adobe.images.BMPEncoder;
import flash.net.navigateToURL;
import flash.display.Sprite;
import flash.events.*;
import flash.net.*;

////////////////////////////////////////////////////////////////////////////
//Initialization

var serverUniqueFileName:String;
mcSavingMsg.visible=false;

//Need to change the name to your sepcified server
var serverPath:String = "./";
//var serverPath:String = "http://localhost/";

var timer:Timer;
var isDownloadProgress = false;

////////////////////////////////////////////////////////////////////////////
// Call this function On Button Save
////////////////////////////////////////////////////////////////////////////

btnSave.addEventListener(MouseEvent.CLICK, clickHandlerBtnSave);

function clickHandlerBtnSave(e:Event)
{
	serverUniqueFileName=getUniqueFileName("Snapshot");
	if(comboFileFormat.selectedItem.label == ".jpg")
	{
		createJPG(mcBg, 85, serverUniqueFileName+".jpg");
	}
	else
	{
		createBmp(mcBg,serverUniqueFileName+".bmp");
	}
	//Similarly Save PNG could be added into the system
}

function timerHandler(event:TimerEvent)
{
}

function timerCompleteHandler(event:Event)
{
	isDownloadProgress=false;
}

var downloadURL:URLRequest;
var file:FileReference;

//////////////////////////////////////////////////////////////////////////////////////////////////////
function FileReference_download()
{
	trace("file to download "+serverPath+serverUniqueFileName);
	downloadURL = new URLRequest();
	downloadURL.url = serverPath+serverUniqueFileName;

	file = new FileReference();
	configureListeners(file);
	file.download(downloadURL, serverUniqueFileName+comboFileFormat.selectedItem.label);
}

function configureListeners(dispatcher:IEventDispatcher)
{
	dispatcher.addEventListener(Event.SELECT, selectHandler);
	dispatcher.addEventListener(Event.COMPLETE, completeHandler);
}

function getUniqueFileName(fileName:String):String
{
	var date:Date = new Date();
	return fileName+date.getTime();
}

function completeHandler(event:Event):void
{
	mcSavingMsg.visible=false;
	deleteDownLoadFile(serverUniqueFileName);
}

function selectHandler(event:Event):void {
	var file:FileReference = FileReference(event.target);
	trace("selectHandler: name=" + file.name + " URL=" + downloadURL.url);
}

//After file is downloaded on Desktop Call this function to delete file from the server
function deleteDownLoadFile(fileName:String)
{
	var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream");
	var jpgURLRequest:URLRequest = new URLRequest (serverPath+"jpg_encoder_download.php?delname=" + fileName);
	jpgURLRequest.requestHeaders.push(header);
	jpgURLRequest.method = URLRequestMethod.POST;
	var jpgURLLoader:URLLoader = new URLLoader();
	jpgURLLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

	jpgURLLoader.addEventListener( Event.COMPLETE, deleteTempServerFile );
	jpgURLLoader.addEventListener( IOErrorEvent.IO_ERROR, sendIOErrorDeleteFile );

	function deleteTempServerFile(evt:Event)
	{
		var write = evt.target.data.write;
		trace ('DeleteFileWrite ' + write);
	}

	function sendIOErrorDeleteFile(event:Event)
	{

	}

	jpgURLLoader.load( jpgURLRequest );
}

//Fired when URL Loading Complete
function imageUrlLoaderComplete(evt:Event)
{
	var write = evt.target.data.write;
	if(write=="yes")
		FileReference_download();
}

function sendIOError(event:Event)
{
	trace("Error occured");
}

////////////////////////////////////////////////////////////////////////////////////
// Creating JPG Image
////////////////////////////////////////////////////////////////////////////////////
function createJPG(m:MovieClip, q:Number, fileName:String="snapshot.jpg")
{
	serverUniqueFileName=fileName;
	var jpgSource:BitmapData = new BitmapData (m.width, m.height);
	jpgSource.draw(m);
	var jpgEncoder:JPGEncoder = new JPGEncoder(q);
	var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);

	var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream");
	var jpgURLRequest:URLRequest = new URLRequest (serverPath+"jpg_encoder_download.php?name=" + fileName);		

	jpgURLRequest.requestHeaders.push(header);
	jpgURLRequest.method = URLRequestMethod.POST;
	jpgURLRequest.data = jpgStream;

	var jpgURLLoader:URLLoader = new URLLoader();
	jpgURLLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
	jpgURLLoader.addEventListener( Event.COMPLETE, imageUrlLoaderComplete );
	jpgURLLoader.addEventListener( IOErrorEvent.IO_ERROR, sendIOError );
	jpgURLLoader.load( jpgURLRequest );
}

/////////////////////////////////////////////////////////////////////////////////////////
//Creating bitmap images
/////////////////////////////////////////////////////////////////////////////////////////

function createBmp(m:MovieClip,fileName:String="snapshot.bmp")
{
	serverUniqueFileName=fileName;
	var bmpSource:BitmapData = new BitmapData (m.width, m.height);
	bmpSource.draw(m);
	var bmpStream:ByteArray = BMPEncoder.encode(bmpSource);

	var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream");
	var bmpURLRequest:URLRequest = new URLRequest (serverPath+"jpg_encoder_download.php?name=" + fileName);
	bmpURLRequest.requestHeaders.push(header);
	bmpURLRequest.method = URLRequestMethod.POST;
	bmpURLRequest.data = bmpStream;

	var bmpURLLoader:URLLoader = new URLLoader();
	bmpURLLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
	bmpURLLoader.addEventListener( Event.COMPLETE, imageUrlLoaderComplete );
	bmpURLLoader.addEventListener( IOErrorEvent.IO_ERROR, sendIOError );
	bmpURLLoader.load( bmpURLRequest );
}&#60;/pre></pre>
</div>
<p></code></div>
</div>
<p class="MsoNormal">Here Server Path will be your server location where your files reside.</p>
<p class="MsoNormal">PHP File to save the image on the server can be downloaded here.  <a title="PHP File Version 2" href="http://actionscript-blog.imaginationdev.com/wp-content/uploads/2008/05/jpg_encoder_download.php">PHP File Version 2</a></p>
<p class="MsoNormal"><strong> For Further details on saving file through FileRefrence class you may contact me if you get stuck some where.</strong></p>
<p class="MsoNormal">Well finally i got time to Bring together a sample project. Kindly Let me know about your remarks if this article is being helpful in solving your problem.</p>
<p class="MsoNormal"><strong><span style="color: #ff0000;">Download Sample Project </span>: <a title="Saving Image Actionscript 3 + PHP" href="http://actionscript-blog.imaginationdev.com/wp-content/uploads/2008/05/saving-image-actionscript-3-php-best-sample.zip">Saving Image Actionscript 3 + PHP</a></strong></p>
<p class="MsoNormal"><strong> A running sample can be viewed at the following link</strong></p>
<p class="MsoNormal"><a title="Save Image actionscript Sample" href="http://www.imaginationdev.com/actionscript-blog/samples/save-image/SaveImage.swf" target="_blank"><strong>www.imaginationdev.com/actionscript-blog/samples/save-image/SaveImage.swf</strong> </a></p>
<p class="MsoNormal">
]]></content:encoded>
			<wfw:commentRss>http://actionscript-blog.imaginationdev.com/5/save-jpg-jpeg-png-bmp-image-action-script-3/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
