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

<channel>
	<title>Flashvalley Blog - Actionscript development</title>
	<atom:link href="http://blog.flashvalley.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.flashvalley.com</link>
	<description>Actionscript development</description>
	<lastBuildDate>Wed, 09 Nov 2011 18:59:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Flash is dead ?</title>
		<link>http://blog.flashvalley.com/?p=1389</link>
		<comments>http://blog.flashvalley.com/?p=1389#comments</comments>
		<pubDate>Wed, 09 Nov 2011 17:10:20 +0000</pubDate>
		<dc:creator>calwen</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://blog.flashvalley.com/?p=1389</guid>
		<description><![CDATA[Adobe has dropped the Flash player on mobile devices have a look at the article here and we can already see a lot of ridiculous and fantaisist articles more based on wishful thinking than on facts flourishing around the web. Some articles are doing the easy jump and are saying that &#8220;Flash is dead&#8221; without [...]]]></description>
			<content:encoded><![CDATA[<p>Adobe has dropped the Flash player on mobile devices have a look at the article <a title="Flash played mobile is dead" href="http://news.google.co.uk/news/url?sa=t&amp;ct2=uk%2F0_0_s_8_0_t&amp;usg=AFQjCNHBZQ7Pqk1bS9LDK0ai7kL7LRQ0kA&amp;did=18d36bddf20fb6bc&amp;cid=8797770222127&amp;ei=iLG6TqDvD4fp8QPLpAE&amp;rt=MORE_COVERAGE&amp;vm=STANDARD&amp;url=http%3A%2F%2Flatimesblogs.latimes.com%2Ftechnology%2F2011%2F11%2Fadobe-to-end-mobile-flash-plug-in-development.html" target="_blank">here</a> and we can already see a lot of ridiculous and fantaisist articles more based on wishful thinking than on facts flourishing around the web. Some articles are doing the easy jump and are saying that &#8220;Flash is dead&#8221; without understanding that Flash is not just about banners. For those who are still unsure of what HTML5 is, I will remind you that HTML5 is mainly a language to create application running in the browser nothing else, Flash is used from the web up to desktop development. The Flash haters are really excited by that news but I am afraid they are going to have to wait a long time before they can burry their long time enemy. Flash is alive and kicking!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.flashvalley.com%2F%3Fp%3D1389&amp;title=Flash%20is%20dead%20%3F" id="wpa2a_2"><img src="http://blog.flashvalley.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.flashvalley.com/?feed=rss2&#038;p=1389</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash vs HTML5</title>
		<link>http://blog.flashvalley.com/?p=5</link>
		<comments>http://blog.flashvalley.com/?p=5#comments</comments>
		<pubDate>Mon, 29 Nov 2010 00:10:13 +0000</pubDate>
		<dc:creator>calwen</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Flash vs HTML5]]></category>
		<category><![CDATA[HTML5]]></category>

		<guid isPermaLink="false">http://blog.flashvalley.com/?p=5</guid>
		<description><![CDATA[Article There is a hot debate at the moment regarding Flash “vs” HTML5. As a Flash developer I thought I would join in to share some of my points of view. Since I am an Actionscript developer you might think that I am going to fall in the easy and logical attitude of defending Flash [...]]]></description>
			<content:encoded><![CDATA[<h2>Article</h2>
<p>There is a hot debate at the moment regarding Flash “vs” HTML5. As a Flash developer I thought I would join in to share some of my points of view. Since I am an Actionscript developer you might think that I am going to fall in the easy and logical attitude of defending Flash and Flex (since Flex is also concerned here) at any cost. That&#8217;s not the case. I am also not going to say that HTML5 is the long awaited Messiah that is going to bring a whole new dimension to your web browsing experience. I think that  the situation needs to be seen from  a more rational and holistic point of view.</p>
<p><span id="more-5"></span></p>
<p>Many arguments are thrown in the air around the debate and tend to go from one extreme to the other one:</p>
<ul>
<li> You have the “Flash-haters”  that generally have never used Flash and hardly know what it does or could do (nor do they with HTML5 ). They keep coming up with the same old arguments  “I hate Flash intros”, “I hate Flash banners”, “I hate Adobe”, “The Flash player crashes my browser”&#8230;etc</li>
<li>You have the “enlightened” HTML5 disciples who think that their new god is going to bring a new web order and that Flash and his minions are doomed.</li>
<li>You have the Flash addicts that cannot be bothered to look at the big picture and will reject anything that could threaten their Flash way of life.</li>
</ul>
<p>Obviously none of the arguments summoned by the categories above are wise since they are based on an emotional approach and not on a pragmatic set of arguments.</p>
<h2>Simplifying web development</h2>
<p>I think there is a higher good, and for the web it is called “open standard”.  The Flash player is a fantastic platform but let’s not forget it is controlled by a single vendor, Adobe,  very much like Windows is controlled by Microsoft.  The Flash player is a wonderful step in the history of the web but it is a plugin and a plugin is something you plug in, it is not native. The big dream is that the internet should be relying on one solid open standard API supported throughout  all browsers and from a philosophical approach HTML5 seems to me like a good step in that direction.<strong><br />
</strong></p>
<h2>A wrong debate</h2>
<p>There is no HTML5 versus Flash, I think they are not really competing to be honest.  I cannot remember when the last time was that I created a full Flash web site, most of my latest big projects are running outside a browser as desktop applications. We all hate Flash intros anyway and I never advocated that Flash was the best choice to create a web site. After the Flash fever that took over the web at the end of the nineties many big corporations, especially in the car industry, moved away from the “pure flash” website and are now using a mix of Flash and HTML instead.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.flashvalley.com%2F%3Fp%3D5&amp;title=Flash%20vs%20HTML5" id="wpa2a_4"><img src="http://blog.flashvalley.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.flashvalley.com/?feed=rss2&#038;p=5</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful Actionscript Libraries and Utilities</title>
		<link>http://blog.flashvalley.com/?p=73</link>
		<comments>http://blog.flashvalley.com/?p=73#comments</comments>
		<pubDate>Wed, 01 Jul 2009 17:33:43 +0000</pubDate>
		<dc:creator>calwen</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[AS3 API]]></category>
		<category><![CDATA[AS3 libraries]]></category>

		<guid isPermaLink="false">http://blog.flashvalley.com/?p=73</guid>
		<description><![CDATA[Article If you have been working with actionscript for a while you should know that the main goal should not just be to &#8220;make it work&#8221; but to make sure that your code is implemented following the rules of simplicity, clarity and elegance. This is not always easy to achieve especially when you have to [...]]]></description>
			<content:encoded><![CDATA[<h2>Article</h2>
<p>If you have been working with  actionscript for a while you should know that the main goal should not  just be to &#8220;make it work&#8221; but to make sure that your code is implemented following the rules of simplicity, clarity and elegance.  This is not always easy to achieve especially when you have to work  under strict deadlines.</p>
<p><span id="more-73"></span></p>
<p>Personally I don&#8217;t have time to reinvent the wheel every  time I start working on a new project and I try to reuse as much as  possible classes and utilities I have already developed (when I had the  time to do so). But since our days just have 24 hours we don&#8217;t always  have the time to create a particular class utility or API for a  particular project therefore it is always precious to know that there is  an existing gold mine of existing utilities which are freely available  over the internet.</p>
<p>I though it would be very informative to give you a list  of class, APIs and utilities that I have been and am still using in  order to simplify my life as a developer, the list below will be updated  regularly, also don&#8217;t hesitate to drop a comment at the bottom if you  found something useful that would deserve to be added to the list.</p>
<h2>Actionscript editors</h2>
<p>If you have been coding in the default Flash  actionscript panel until  now it might be time to review the situation  because there is better solutions out there.</p>
<ul>
<li><a href="http://www.flashdevelop.org/">Flashdevelop</a> is  my prefered actionscript editor for the main reason that it enhances my  productivy massively, the only downside for now is that it does not has a  refactoring and autoformat utility. When I need to do that I will use  Flex in parallel. In any case I will favor Flashdevelop over any other  actionscript editor.</li>
</ul>
<ul>
<li><a href="http://fdt.powerflasher.com/">FDT3</a> is a dedicated actionscript editor built on Eclipse,  it is a powerful editor and it has many features that Flashdevelop does  not have but I am not a big fan of Eclipse and therefore this wasn&#8217;t my  first choice. Also FDT is fairly expensive while Flashdevelop is free  (donations warmly accepted if you like it) I recommend you have a look  at it and install the 30 days demo.</li>
</ul>
<p>Although I am not a big fan of Eclipse I would still  recommend that you learn to use Flex and FDT since those two  applications are used extensively in the Flash industry and you will  need to know how to use them if you want to raise your chances to get a  job in the Flash and Flex industry <img src='http://blog.flashvalley.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I am not going to write much about Flex here because it  is more than a coding environment and I have already wrote and article  on Flash and Flex.</p>
<p>There are other actionscript editors out there that you  might want to have a look at, there are not in my favourite list because  they either lack support for AS3 or are don&#8217;t fit my needs but since we  all have different tastes and needs you can also have a look at: <a href="http://www.sephiroth.it/python/sepy.php" target="_blank">Sepy</a>,  <a href="http://www.primaltools.com/products/info.asp?p=PrimalScript" target="_blank">PrimalScript</a>, <a href="http://asdt.org/" target="_blank">ASDT</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.flashvalley.com%2F%3Fp%3D73&amp;title=Useful%20Actionscript%20Libraries%20and%20Utilities" id="wpa2a_6"><img src="http://blog.flashvalley.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.flashvalley.com/?feed=rss2&#038;p=73</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex: a Flash developer point of view</title>
		<link>http://blog.flashvalley.com/?p=80</link>
		<comments>http://blog.flashvalley.com/?p=80#comments</comments>
		<pubDate>Tue, 24 Mar 2009 21:21:26 +0000</pubDate>
		<dc:creator>calwen</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.flashvalley.com/?p=80</guid>
		<description><![CDATA[Article I have been working with Flash for about 10 years now, I have seen it growing and improving over the years and I became very familiar with that piece of software. Flash is a familiar working environment and when I start developing I know where I need to go and I know how to [...]]]></description>
			<content:encoded><![CDATA[<h2>Article</h2>
<p>I have been working with  Flash for about 10 years now, I have seen it growing and improving over  the years and I became very familiar with that piece of software. Flash  is a familiar working environment and when I start developing I know  where I need to go and I know how to get there. It took a lot of time  and patience, actionscript has changed over the years and  I have also felt frustration at times but I have always managed to do  what I wanted to do with Flash and I could not see a reason to change  the way things were.<br />
<span id="more-80"></span></p>
<h2>A discrete newcomer</h2>
<p>When I first heard about <a href="http://www.adobe.com/products/flex/flexdownloads/index.html" target="_blank">Flex</a> I must say that I did not pay too much attention to it, especially that  it came as a SDK without user interface and since I have never been a  big fan of command lines it didn&#8217;t help to attract me. Also Flash CS3  wasn&#8217;t released at that time and therefore my AS3.0 experience was  pretty poor.</p>
<p>Then came  <a href="http://www.adobe.com/products/flex/">Flex builder</a>, a  product with a user friendly interface built on top of the Flex SDK. I  decided to give it a go and installed a demo version and I have to say  it wasn&#8217;t love at first sight, no timeline, no design tools, a strange  way of mixing MXML tags and Actionscript. All that seemed a bit  confusing to me and I could not see the point of learning a software to  develop applications that I could already develop entirely in Flash  therefore at that point I did not spent too much time with Flex and went back to my first love.</p>
<h2>Developing RIAs with Flash</h2>
<p>At that time I was working in an e-learning company and was  working on a couple of applications involving live data, those  applications  would probably fall today in the RIA (Rich Internet Application) category.  I had decided to use Flash since I was very familiar with the software  and actionscript 2.0 at that time. As I was moving along in the  development I quickly realised that, although Flash had a fair amount of  useful components, it was still necessary to write a lot of code to  deal with simple data operations and to adjust the display to the data  changes. After a fair amount of trials and errors I finally reached a  satisfying result, but I was left with a feeling that if I had to do it  again I might have a second look at Flex that was apparently perfectly  adapted to the development of RIAs.  I was especially looking for a way  to simplify my workflow and enhance my productivity.</p>
<p>After that experience of developing my first RIAs  in Flash,  Flash CS3 was released and, as I was starting to fiddle with  AS3.0,  I thought it would be a good time to have a second look at  Flex. This time I wasn&#8217;t just driven by a simple curiosity but I was  really looking for some precise answers. I had met precise problems with  Flash and I wanted to see if Flex would help me to solve them more  easily. At the end of the day I am a developer and what I worry about is  scalability, reusability, maintenance and productivity and I wasn&#8217;t so  sure that Flash was the best way to solve those issues when it comes to  develop RIAs.</p>
<h2>Why Flex Builder is more suited to application developement</h2>
<p>I have now been using Flex for a while and I love it <img src='http://blog.flashvalley.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I  suddenly realised that if it is for me the perfect tool to develop RIAs. Don&#8217;t worry you can develop RIAs in Flash, there is nodiscussion about that but Flex will vastly enhance your productivity.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.flashvalley.com%2F%3Fp%3D80&amp;title=Flex%3A%20a%20Flash%20developer%20point%20of%20view" id="wpa2a_8"><img src="http://blog.flashvalley.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.flashvalley.com/?feed=rss2&#038;p=80</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loading XML in Actionscript 3.0 (Flash CS3, CS4)</title>
		<link>http://blog.flashvalley.com/?p=633</link>
		<comments>http://blog.flashvalley.com/?p=633#comments</comments>
		<pubDate>Thu, 05 Feb 2009 11:46:22 +0000</pubDate>
		<dc:creator>yeli</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Loading XML in AS3]]></category>
		<category><![CDATA[XML in AS3]]></category>

		<guid isPermaLink="false">http://blog.flashvalley.com/?p=633</guid>
		<description><![CDATA[Tutorial Things have changed a little bit in AS3.0 when it comes to load XML but I am going to show you it is very easy to do once you done it a couple of times. In AS3.0 It is a bit different because as you know you need to write a bit more code [...]]]></description>
			<content:encoded><![CDATA[<h2>Tutorial</h2>
<p>Things have changed a little bit in AS3.0 when  it comes to load XML but  I am going to show you it is very easy to do  once you done it a couple of times.<span id="more-633"></span></p>
<p>In AS3.0 It is a bit different  because as you know you need to write a  bit more code to accomplish simple tasks. Let&#8217;s have a look at the  tutorial.</p>
<p>First let&#8217;s create a little XML document that describe a list of fruits.</p>
<p><a href="http://blog.flashvalley.com/wp-content/uploads/2010/12/xml1.jpg"><img class="alignnone size-full wp-image-1037" title="xml1" src="http://blog.flashvalley.com/wp-content/uploads/2010/12/xml1.jpg" alt="" width="485" height="159" /></a></p>
<p>Save your XML list as <strong>fruits.xml</strong> and open a new AS3.0 document in Flash, on the first frame enter the code below:</p>
<div class="codecolorer-container actionscript3 vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.net</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.*</span><br />
<br />
<span style="color: #6699cc; font-weight: bold;">var</span> myFruitsData<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=urlrequest%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlrequest.html"><span style="color: #004993;">URLRequest</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=urlrequest%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlrequest.html"><span style="color: #004993;">URLRequest</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;fruits.xml&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #6699cc; font-weight: bold;">var</span> myFruitsLoader<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=urlloader%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlloader.html"><span style="color: #004993;">URLLoader</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=urlloader%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlloader.html"><span style="color: #004993;">URLLoader</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
myFruitsLoader<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">COMPLETE</span><span style="color: #000066; font-weight: bold;">,</span>completeListener<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #339966; font-weight: bold;">function</span> completeListener<span style="color: #000000;">&#40;</span>evt<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> myFruits<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=xml%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xml.html"><span style="color: #004993;">XML</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=xml%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xml.html"><span style="color: #004993;">XML</span></a><span style="color: #000000;">&#40;</span>evt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">data</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>myFruits<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span><br />
myFruitsLoader<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">load</span><span style="color: #000000;">&#40;</span>myFruitsData<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></td></tr></tbody></table></div>
<p>1. The first two lines import the <strong>URLRequest</strong>, <strong>URLloader</strong> and <strong>Event</strong> classes. Note that if you are writing the code in a class you also need to import additional classes.</p>
<p>2. The first thing we are doing is to create a  URLRequest object that will contain the path to the xml file. In AS2.0  this wasn&#8217;t needed.</p>
<p>3. The next step is to create an URLloader object  that will serve as a container for our XML document. myFruitsLoader will  also serve as a loader that will inform us when it has loaded the  entire document. The <strong>Event.COMPLETE</strong> is the AS3.0 version of our old <strong>onLoad</strong> AS2.0 event and it behaves the same way: When the data is loaded it will call the <strong>completeListener</strong> function where we will process the loaded data.</p>
<p>4. Once the data (loaded by default as TEXT) has completed loading the <strong>completeListener</strong> function is called, what we immediately do is to convert the loaded  data into an XML object by creating an XML object from the evt.<strong>target.data</strong> data.</p>
<p>It is important to note here that it is the  URLLoader object that contains the loaded data and that it can be access  using myFruitsLoader.<strong>data</strong> or evt<strong>.target.data </strong>like in my example.</p>
<p>That&#8217;s it basically, in the next tutorial I will show you how to access the loaded XML data.</p>
<p><img style="vertical-align: text-top;" src="http://www.flashvalley.com/images/wizard.gif" alt="" width="24" height="21" /><span style="font-size: x-small;"><span style="color: #ffcc00;"><em><strong>Calwen</strong></em></span></span></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.flashvalley.com%2F%3Fp%3D633&amp;title=Loading%20XML%20in%20Actionscript%203.0%20%28Flash%20CS3%2C%20CS4%29" id="wpa2a_10"><img src="http://blog.flashvalley.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.flashvalley.com/?feed=rss2&#038;p=633</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>attachMovie in AS3 (Flash CS3)</title>
		<link>http://blog.flashvalley.com/?p=638</link>
		<comments>http://blog.flashvalley.com/?p=638#comments</comments>
		<pubDate>Wed, 17 Dec 2008 11:52:02 +0000</pubDate>
		<dc:creator>yeli</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[addChild in AS3]]></category>
		<category><![CDATA[attachMovie in AS3]]></category>

		<guid isPermaLink="false">http://blog.flashvalley.com/?p=638</guid>
		<description><![CDATA[Tutorial You might have been wondering where attachMovie has gone in Actionscript 3.0, well no need to look for it because it&#8217;s gone. In Actionscript 3.0 you will have to use another way to attachMovie clips on the stage at runtime, I am going to tell you all about it in that little tutorial. The [...]]]></description>
			<content:encoded><![CDATA[<h2>Tutorial</h2>
<p>You might have been wondering where <strong>attachMovie</strong> has gone in Actionscript 3.0, well no need to look for it because it&#8217;s  gone. In Actionscript 3.0 you will have to use another way to  attachMovie clips on the stage at runtime, I am going to tell you all  about it in that little tutorial.<br />
<span id="more-638"></span></p>
<h2>The default way</h2>
<p>When you create a movie clip in an AS3 Flash file  and select &#8220;export for actionscript you will notice that the Class and  Base class are automatically filled up (see picture below), what does  that mean in the AS3 world?</p>
<p><img src="http://www.flashvalley.com/fv_tutorials/attachMovie%20in%20Actionscript%203.0/pic1.jpg" alt="" width="414" height="309" /></p>
<p>Flash automatically fills the Class name field with the name you gave to your movie clip, square in our case. Also since it is a movie clip that we are creating it automatically fills the Base class field with <strong>flash.display.MovieClip</strong>.</p>
<p>You don&#8217;t need to worry about the Base class, that  means that your movie clip is going to inherit of all the properties and  methods assigned to the MovieClip class. In AS2.0 this was happening in  the background but you just did not know about it.</p>
<p>More importantly you can also see that the class <strong>square</strong> has automatically been assigned to the movie clip, this is an important  bit, it means that the compiler will be automatically looking for<strong> square.as</strong> (a physical class that you actually created) in the directory where  your Flash file resides, if it can&#8217;t find it it will create a default  one for you. You don&#8217;t need to create a <strong>square</strong> class if you have nothing to put in it.</p>
<p>Ok, our movie clip is now sitting in the library, we  now need to create the code that will attach it on the stage, this is  what we are doing below:</p>
<div class="codecolorer-container actionscript3 vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6699cc; font-weight: bold;">var</span> mySquare<span style="color: #000066; font-weight: bold;">:</span>Square = <span style="color: #0033ff; font-weight: bold;">new</span> Square<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>mySquare<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></td></tr></tbody></table></div>
<p>As simple as that, we create an  instance of the square class (that will automatically be created by  Flash or that you created yourself) using the new keyword and then we  use the magic word addChild with the name of the square instance we just  created. Notice that we are not using any linkage id anymore when we  use addChild but instead we are using the name of the instance of the  class.</p>
<p>That&#8217;s it if you run your file you will now see  that your movie clip is attached to the the top left corner of the  stage.</p>
<p>Create your own class</p>
<p>If you want to create a little class for your  square, it is easy, got in FILE &gt; NEW and in the window select  ACTIONSCRIPT FILE</p>
<p>Now you can create your class, a very simple square class could be like the one below:</p>
<div class="codecolorer-container actionscript3 vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span><br />
<br />
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> square <span style="color: #0033ff; font-weight: bold;">extends</span> <a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"><span style="color: #004993;">MovieClip</span></a><span style="color: #000000;">&#123;</span><br />
<br />
<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> square<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span><br />
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;hello I am an instance of the square class&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></td></tr></tbody></table></div>
<p>Save the actionscript file as <strong>square.as</strong> in the directory where your FLA resides and here you go, Flash will now use that class instead of a default one.</p>
<p>Hopefully this little tutorial will be helpful for you <img src='http://blog.flashvalley.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><img style="vertical-align: text-top;" src="http://www.flashvalley.com/images/wizard.gif" alt="" width="24" height="21" /><span style="font-size: x-small;"><span style="color: #ffcc00;"><em><strong>Calwen</strong></em></span></span></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.flashvalley.com%2F%3Fp%3D638&amp;title=attachMovie%20in%20AS3%20%28Flash%20CS3%29" id="wpa2a_12"><img src="http://blog.flashvalley.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.flashvalley.com/?feed=rss2&#038;p=638</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MDM Zinc 3.0  beta preview</title>
		<link>http://blog.flashvalley.com/?p=110</link>
		<comments>http://blog.flashvalley.com/?p=110#comments</comments>
		<pubDate>Mon, 02 Jun 2008 15:27:43 +0000</pubDate>
		<dc:creator>calwen</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[MDM Zinc review]]></category>

		<guid isPermaLink="false">http://blog.flashvalley.com/?p=110</guid>
		<description><![CDATA[If you don&#8217;t know what Zinc is, it is a third party tool used by Flash developers to create advanced projectors (exe files) that can be used as desktop applications or desktop gadgets. Over the years these tools, also called &#8220;SWFtoEXE&#8221;, have evolved to a point where it is now possible to create very interactive [...]]]></description>
			<content:encoded><![CDATA[<p><a title="MDM Zinc 3.0 aka Pandora" rel="lightbox" href="http://www.flashvalley.com/fv_articles/MDM_Zinc_3.0_%28Pandora%29_preview/images/pic1.jpg"><img class="alignleft" style="border: 0pt none;" src="http://www.flashvalley.com/fv_articles/MDM_Zinc_3.0_%28Pandora%29_preview/images/pic1_thumb.jpg" border="0" alt="MDM Zinc 3.0" width="150" height="120" align="left" /></a>If  you don&#8217;t know what Zinc is, it is a third party tool used by Flash  developers to create advanced projectors (exe files) that can be used as  desktop applications or desktop gadgets.</p>
<p>Over the years these tools, also called &#8220;SWFtoEXE&#8221;, have  evolved to a point where it is now possible to create very interactive  desktop applications that can, for example, pull content from a remote  server or create and save a file locally. You can even create a little  FTP client in Flash and many other interesting things that could not be  created with Flash alone.</p>
<p><span id="more-110"></span></p>
<p>For those of you who haven&#8217;t followed the latest news on the <a href="http://www.mdmforum.com/forum/" target="_blank">MDM forum</a>,  you will be pleased to know that on the 18th January MDM Zinc 3.0 (aka  &#8220;Pandora&#8221;) Beta  was released for all Registered Zinc 2.x Users.</p>
<p>The full version will be available to buy and download  on the 31st January 2008. I also suspect a demo will be made available  around that time for those who want to give it a try before buying it.</p>
<p>MDM has been very silent regarding the development of  the new version of Zinc, at least for those who were not participating  in the closed beta. Very few updates for the previous version have been  released over the past 6 months and there has been a noticeable lack of  support on the MDM forum.  I guess the developer team was concentrating  on the new version of the software instead of &#8220;patching the old&#8221;. We  can&#8217;t really blame them for this since, at the end of the day, we should  be benefiting from their efforts. Anyway, Zinc 3.0 is a week away and  hopefully here to stay. For now let&#8217;s have a closer look at the beta  version&#8230;</p>
<h2>First impressions</h2>
<p><a title="The new MDM Zinc 3.0 interface" rel="lightbox" href="http://www.flashvalley.com/fv_articles/MDM_Zinc_3.0_%28Pandora%29_preview/images/pic2.jpg"><img class="alignleft" style="border: 0pt none;" src="http://www.flashvalley.com/fv_articles/MDM_Zinc_3.0_%28Pandora%29_preview/images/pic2_thumb.jpg" border="0" alt="Zinc 3.0 Interface" width="150" height="88" align="left" /></a>After  a quick and painless installation on my Vista Home premium laptop and  starting the application the first thing that I noticed  was that the  new interface has been skinned in a very &#8220;Windows Vista&#8221; fashion (click picture on the left).I am not a big fan of this type of fancy skin and  hopefully there will be some possibilities in the final version to swap  back to a more classic type of skin. Anyway this is just a little  detail. Let&#8217;s now have a look at the new layout itself.</p>
<p>You will notice that the layout has changed; all  elements of the interface can be moved around and rearranged at your  convenience very much like in Flash. This is a neat feature although it  took me a bit of time to understand how you could hook the panel in the  right position using the little icons ( top, left, right and bottom  icons) that appear as soon as you start dragging a panel around. Once  you have understood the concept it is actually very easy to move  everything around.</p>
<p><a title="MDM Zinc 3.0 Application panel" rel="lightbox" href="http://www.flashvalley.com/fv_articles/MDM_Zinc_3.0_%28Pandora%29_preview/images/pic4.jpg"><img class="alignleft" style="border: 0pt none;" src="http://www.flashvalley.com/fv_articles/MDM_Zinc_3.0_%28Pandora%29_preview/images/pic4_thumb.jpg" border="0" alt="MDM Zinc 3.0 Application panel" width="84" height="150" align="left" /></a>All  properties and parameters for your Zinc Application can now be set  using these panels. It is actually a lot quicker than in the previous  version where you had to navigate through different tabs to set the  properties end parameters for your Zinc application. I have taken a  screenshot of the Application panel  (click picture on the left) which will give you a good idea of what I mean.</p>
<p>After fiddling for 15 minutes with the different panels  and moving them around I have to say that the new layout in version 3  feels a lot more natural than the one in version 2. Although I haven&#8217;t  been working with this new version of Zinc for a long time  I have no  doubt that it will enhance my productivity.</p>
<p>Also it is important to note that the application starts  pretty quickly and is very responsive. As an indicator I am using Vista  Home premium with an Intel Core 2 Duo T7100 with 2gigs of Ram, I have  not tried it on XP but from my experience with Vista, XP users should   notice an even greater increase in responsiveness.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.flashvalley.com%2F%3Fp%3D110&amp;title=MDM%20Zinc%203.0%20%20beta%20preview" id="wpa2a_14"><img src="http://blog.flashvalley.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.flashvalley.com/?feed=rss2&#038;p=110</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Should you learn Object Oriented Programming with Actionscript ?</title>
		<link>http://blog.flashvalley.com/?p=85</link>
		<comments>http://blog.flashvalley.com/?p=85#comments</comments>
		<pubDate>Sat, 02 Feb 2008 21:29:45 +0000</pubDate>
		<dc:creator>calwen</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[OOP in Actionscript]]></category>
		<category><![CDATA[OOP in AS3]]></category>

		<guid isPermaLink="false">http://blog.flashvalley.com/?p=85</guid>
		<description><![CDATA[Article You have heard about Object Oriented Programming before (OOP) but you are not too sure what it is and if you really need to learn a bit more about it. You have heard that if you want to use Actionscript 3.0 you will need to learn OOP and you are now wondering if you [...]]]></description>
			<content:encoded><![CDATA[<h2>Article</h2>
<p>You have heard about Object Oriented Programming before  (OOP) but you are not too sure what it is and if you  really need to  learn a bit more about it. You have heard that if you want to use  Actionscript 3.0 you will need to learn OOP and you are now wondering if  you should really start reading about it. Well good timing because it  is for you that I am writing this article.<br />
<span id="more-85"></span></p>
<h2>Flash is about OOP</h2>
<p>If you have programmed in actionscript before then you  will already have done some OOP probably without  knowing it. When you  create a Movie clip on the stage, give it an instance name and add an  onPress event to it, this is OOP <img src='http://blog.flashvalley.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  This Movie clip is an instance of  the MovieClip class and you are using the onPress method of that class  on that particular instance, this is Object Oriented Programming.</p>
<p>In Flash, movie clips, text fields, sounds, graphics are  all objects that are created from a pattern called a class. In  actionscript 2.0 you did not need to worry about these classes because  they are native to Flash, they don&#8217;t need to be imported or created and  work in the background. When you drop a movie clip on the stage it  automatically creates a new instance of the movie clip class for you.</p>
<p>OOP is all about classes, objects, properties and  methods, but before that it is a conceptual approach of programming that  is supposed to help us to develop, maintain and organize our code. When  you will know more about OOP you will just realize that it is a very  natural way of programming and I am going to explain  why.</p>
<h2>OOP: a natural concept</h2>
<p>As I stated previously, OOP is  all about classes, objects, properties and methods and the relations between objects. A class can be characterized by a collection of methods and properties.</p>
<div><img class="alignleft" src="http://www.flashvalley.com/fv_articles/Should_you_learn_Object_Oriented_Programming_with_Actionscript/images/pic1.jpg" alt="Solar system" width="250" height="118" />You could for example define the following set of properties in the  PlanetClass  : size(number), revolution duration(number), distance from  the  sun(number), does it have an atmosphere (true or false), does it  have  satellites (true or false)..etc</div>
<p>Each planet has properties but also has behaviors or actions like: rotation, revolution that we could define as methods of the PlanetClass.<br />
So basically all planets are instances of the PlanetClass. The solar system could also be an instance of the SolarSystem class with its own properties that  would contain all the instances of the PlanetClass</p>
<p>Another example would be the human body which acts as a  whole but with different parts that have their own properties and  methods. so we could have a Body class with its properties and methods but also a finger class, a stomach class, each with their properties and methods.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.flashvalley.com%2F%3Fp%3D85&amp;title=Should%20you%20learn%20Object%20Oriented%20Programming%20with%20Actionscript%20%3F" id="wpa2a_16"><img src="http://blog.flashvalley.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.flashvalley.com/?feed=rss2&#038;p=85</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mouse events in Actionscript 3.0 (Flash CS3)</title>
		<link>http://blog.flashvalley.com/?p=644</link>
		<comments>http://blog.flashvalley.com/?p=644#comments</comments>
		<pubDate>Fri, 23 Nov 2007 11:58:34 +0000</pubDate>
		<dc:creator>yeli</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Mouse events in AS3]]></category>
		<category><![CDATA[MouseEvent AS3]]></category>

		<guid isPermaLink="false">http://blog.flashvalley.com/?p=644</guid>
		<description><![CDATA[Tutorial The event system has been revamped in actionscript 3.0, for the best of your future applications but for the worse if you still don&#8217;t understand how to use it. Hopefully this little tutorial should bring some light on your knowledge. So you just started AS3.0 full of excitement and ready for some coding challenges, [...]]]></description>
			<content:encoded><![CDATA[<h2>Tutorial</h2>
<p>The event system has been revamped in  actionscript 3.0, for the best of your future applications but for the  worse if you still don&#8217;t understand how to use it. Hopefully this little  tutorial should bring some light on your knowledge.<span id="more-644"></span></p>
<p>So you just started AS3.0 full of excitement and  ready for some coding challenges, you start coding your first button and  suddenly, horror, you end up with <strong>&#8220;WARNING:  Actions on button or MovieClip instances are not supported in  ActionScript 3.0. All scripts on object instances will be ignored.&#8221;</strong> or <strong>&#8220;1119: Access of possibly undefined property onPress through a reference with static type flash.display:SimpleButton.&#8221;</strong>, indeed  the good old AS2.0 event system is not working anymore in AS3.0: <strong>onClipEvent</strong>, <strong>onPress</strong>, <strong>onRelease</strong>, <strong>onLoad</strong>, <strong>onMouseDown</strong> ..etc,  have become things of the past!!!</p>
<p>What happened? well basically the whole event handling  system has been revamped in Actionscript 3.0 and we are going to have a  quick look at it. Since most of the Flashvalley users are looking for  simple explanations and practical tutorials I am not going to go into a  complex discussion about the new event handling system but we will  quickly go in practical working examples.</p>
<p>What you need to know is that the most noticeable  difference between event handling in ActionScript 3.0 and   event  handling in previous versions of ActionScript is that in ActionScript  3.0   there is only one system for event handling, whereas in previous  versions of   ActionScript there are several different event-handling  systems. <strong>In AS2.0 events can be handled differently and following different patterns:</strong></p>
<ul>
<li>on() event handlers that can be placed directly on Button and   MovieClip instances</li>
<li>onClipEvent() handlers that can be placed directly on MovieClip   instances</li>
<li>Callback function properties, such as XML.onload and   Camera.onActivity</li>
<li>Event listeners that you register using the addListener()   method</li>
<li>The UIEventDispatcher class that partially   implemented the DOM event model.</li>
</ul>
<p><strong>In AS3.0, and to summarize,                  all events are handled with the following logical pattern:</strong></p>
<div class="codecolorer-container actionscript3 vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339966; font-weight: bold;">function</span> eventListener<span style="color: #000000;">&#40;</span>eventObject<span style="color: #000066; font-weight: bold;">:</span>EventType<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
<span style="color: #009900; font-style: italic;">// Actions performed in response to the event go here.</span><br />
<span style="color: #000000;">&#125;</span><br />
<br />
eventTarget<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>EventClass<span style="color: #000066; font-weight: bold;">.</span>EVENT_NAME<span style="color: #000066; font-weight: bold;">,</span> eventListener<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></td></tr></tbody></table></div>
<p>In AS3.0 there is a wide range of events types, representing  everything from user input to network and sound activity. Before setting  up your event you will first need to find the correct event class along  with the correct constant associated to that particular type of event</p>
<p>Let&#8217;s put that into practise with a couple of examples.</p>
<p><strong>1. Mouse events </strong></p>
<p>In AS3.0 all interactivities based on mouse clicks,  mouse wheel and mouse moves are now going to be handled with that new  event system.</p>
<p>if you want to  to detect a mouse click anywhere on the  stage you will need to attach and to define a listener to the stage  object like below:</p>
<div class="codecolorer-container actionscript3 vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339966; font-weight: bold;">function</span> myClick<span style="color: #000000;">&#40;</span>eventObject<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;mouse click detected&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span><br />
<br />
<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> myClick<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></td></tr></tbody></table></div>
<p>The name of the event is defined by the constant associated with the  event class. In our case  CLICK is one of the events associated with the  MouseEvent class, the  events defined for the MouseEvent class  are  CLICK, DOUBLE_CLICK, MOUSE_DOWN, MOUSE_UP, MOUSE_MOVE, MOUSE_OUT,  MOUSE_OVER, MOUSE_WHEEL, ROLL_OUT, ROLL_OVER.</p>
<p>To attach a behaviour to a button in AS 2.0 you would attach the following code to that button:</p>
<div class="codecolorer-container actionscript vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">on</span><span style="color: #66cc66;">&#40;</span>release<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
<span style="color: #808080; font-style: italic;">// do something</span><br />
<span style="color: #66cc66;">&#125;</span></div></td></tr></tbody></table></div>
<p>or if the button is a movie clip you will attach:</p>
<div class="codecolorer-container actionscript vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">onClipEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
<span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">onPress</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
<span style="color: #808080; font-style: italic;">// do something</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></td></tr></tbody></table></div>
<p>or you in both cases you could define the behaviour in a frame of the timeline:</p>
<div class="codecolorer-container actionscript vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">myButton.<span style="color: #0066CC;">onPress</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
<span style="color: #808080; font-style: italic;">// do something</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></td></tr></tbody></table></div>
<p>Continue to the next page&#8230;</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.flashvalley.com%2F%3Fp%3D644&amp;title=Mouse%20events%20in%20Actionscript%203.0%20%28Flash%20CS3%29" id="wpa2a_18"><img src="http://blog.flashvalley.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.flashvalley.com/?feed=rss2&#038;p=644</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transferring data across domains using crossdomain.xml (MX, MX2004, 8)</title>
		<link>http://blog.flashvalley.com/?p=656</link>
		<comments>http://blog.flashvalley.com/?p=656#comments</comments>
		<pubDate>Sun, 01 Jul 2007 12:38:24 +0000</pubDate>
		<dc:creator>yeli</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[crossdomain.xml]]></category>
		<category><![CDATA[crossdomain.xml tutorial]]></category>

		<guid isPermaLink="false">http://blog.flashvalley.com/?p=656</guid>
		<description><![CDATA[Tutorial In many occasions you might want a SWF to be able to retrieve data from another domain, by loading variables from a text file for example, or you might want to send data from a Flash email form to a PHP script that is sitting on another domain. With Flash player 6 a security [...]]]></description>
			<content:encoded><![CDATA[<h2>Tutorial</h2>
<p>In many occasions you might want a SWF to be  able to retrieve data from another domain, by loading variables from a text file for example, or you might want to send data from a Flash email  form to a PHP script that is sitting on another domain.</p>
<p><span id="more-656"></span></p>
<p>With Flash player 6 a security sandbox  implemented a restriction : a movie sitting on one domain would be  prevented from loading data from another domain. In  Flash Player 6, sub domains of the same parent domain could access each  other&#8217;s data this is not the case anymore starting with Flash player 7,  domains must be  identical for data to be read.</p>
<p>Luckily there is a way to allow the Flash player to gather  or send data from another domain, this is what we can find in the Flash  8 manual :</p>
<div style="text-align: justify; margin: auto; width: 70%; background-color: #222222; padding: 20px; font-size: 11px;"><span style="color: #808080;"><em>When a Flash document attempts to access data from another domain,  Flash Player   will automatically attempts to load a policy file from  that domain. If the domain of   the Flash document that is attempting to  access the data is included in the   policy file, the data is  automatically accessible. Policy files must be named </em><em>crossdomain.xml</em><em>,  and   can reside either at the root directory or in another directory  on the server   that is serving the data with some additional  ActionScript.</em></span></div>
<p><br/>Here we are, let&#8217;s have a look in more details at a crossdomain.xml :</p>
<div class="codecolorer-container xml vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span></div></td></tr></tbody></table></div>
<p>Then we have the <strong><cross-domain-policy></strong> tag that will encapsulates all the <strong><allow-access-from></strong> tags.</p>
<p>All the <strong><allow-access-from></strong> tags have an attribute domain that can either specified an exact IP address, an exact domain, or a wildcard <strong>domain</strong> (any domain).</p>
<p>If you specify an IP address you will need your  SWF file to access the data source using the ip address in the web  address like <strong>http://234.123.18.1/myVariables.txt</strong>, the Flash player won&#8217;t do any DNS conversion so you can&#8217;t just enter the domain name bound to that IP as it won&#8217;t work.</p>
<p>Be aware that using <strong><allow-access-from domain="flashvalley.com" /></strong> won&#8217;t grant access to the data source to your SWF if you try to access it using <strong>http://www.flashvalley.com</strong> and  vice versa. To be sure that you will be able to access it from both  url, the one with the www and the one without it you will need to  specify both domain or to use a wild card like <strong>*.flashvalley.com</strong> If you want to allow access to your server to all  IPs and domain names just use a simple wild card as below :</p>
<div class="codecolorer-container xml vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cross-domain-policy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;allow-access-from</span> <span style="color: #000066;">domain</span>=<span style="color: #ff0000;">&quot;*&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cross-domain-policy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></td></tr></tbody></table></div>
<p>If you have a data source sitting on HTTPS  server and you want a SWF sitting on HTTP server to be able to access  you will have to add the attribute <strong>secure</strong> to the <strong><allow-access-from></strong> tag as well as setting it to <strong>false</strong> (see example below).</p>
<div class="codecolorer-container xml vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cross-domain-policy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;allow-access-from</span> <span style="color: #000066;">domain</span>=<span style="color: #ff0000;">&quot;www.flashvalley.com&quot;</span> <span style="color: #000066;">secure</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cross-domain-policy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></td></tr></tbody></table></div>
<p>If you want to be able to customize the location and the name of your policy file you can use the <strong>System.security.loadPolicyFile</strong> method. This method will only work if the client is using a post Flash player 7.0.14.0.</p>
<p>With the addition of <strong>System.security.loadPolicyFile</strong>, Flash Player 7.0.19.0 can load policy files from arbitrary locations, as shown in the   following example:</p>
<div class="codecolorer-container actionscript vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">System</span>.<span style="color: #006600;">security</span>.<span style="color: #006600;">loadPolicyFile</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;http://mydomain.com/sub/dir/myPolicyFile.xml&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></td></tr></tbody></table></div>
<p><br/><img style="vertical-align: text-top;" src="http://www.flashvalley.com/images/wizard.gif" alt="" width="24" height="21" /><span style="font-size: x-small;"><span style="color: #ffcc00;"><em><strong>Calwen</strong></em></span></span></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.flashvalley.com%2F%3Fp%3D656&amp;title=Transferring%20data%20across%20domains%20using%20crossdomain.xml%20%28MX%2C%20MX2004%2C%208%29" id="wpa2a_20"><img src="http://blog.flashvalley.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.flashvalley.com/?feed=rss2&#038;p=656</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

