<?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>zedia flash blog &#187; ActionScript 2</title>
	<atom:link href="http://www.zedia.net/tag/actionscript-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zedia.net</link>
	<description>Flash, ActionScript, SEO and everything in between</description>
	<lastBuildDate>Wed, 21 Jul 2010 17:07:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Again on BlendMode (this time in AS2)</title>
		<link>http://www.zedia.net/2008/again-on-blendmode-this-time-in-as2/</link>
		<comments>http://www.zedia.net/2008/again-on-blendmode-this-time-in-as2/#comments</comments>
		<pubDate>Tue, 27 May 2008 23:21:10 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[ActionScript 2]]></category>
		<category><![CDATA[BlendMode]]></category>
		<category><![CDATA[fade out]]></category>
		<category><![CDATA[Layer]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2008/again-on-blendmode-this-time-in-as2/</guid>
		<description><![CDATA[I was really happy when I found out how to do proper fade outs of MovieClips containing other MovieClips, but I am even more happy now because I found how to do it in ActionScript 2. I don&#8217;t know why but I was thinking that blendMode was something new that came in Flash 9, but [...]]]></description>
			<content:encoded><![CDATA[<p>I was really happy when I found out <a href="http://www.zedia.net/2008/blendmodelayer-a-must-when-changing-alpha-of-a-displayobject-containing-other-displayobject/" title="BlendMode.LAYER">how to do proper fade outs of MovieClips containing other MovieClips</a>, but I am even more happy now because I found how to do it in ActionScript 2. I don&#8217;t know why but I was thinking that blendMode was something new that came in Flash 9, but I actually knew it came with Flash 8 at the same time that filters came in. I woke up when my colleague told me he and to roll back an animation from Flash 8 to Flash 7 and had to loose the blendModes because of that.</p>
<p>The way to do it is really similar than in ActionScript 3, it&#8217;s actually way easier but more prone to errors (if you mispell &#8220;layer&#8221; the compiler won&#8217;t tell you):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">my_mc.<span style="color: #006600;">blendMode</span> = <span style="color: #ff0000;">&quot;layer&quot;</span>;</pre></td></tr></table></div>

<p>That&#8217;s all there is to it.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.zedia.net%2F2008%2Fagain-on-blendmode-this-time-in-as2%2F&amp;layout=standard&amp;show-faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:550px; height:70px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2008/again-on-blendmode-this-time-in-as2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>generate random Strings in AS2 or AS3</title>
		<link>http://www.zedia.net/2008/generate-random-strings-in-as2-or-as3/</link>
		<comments>http://www.zedia.net/2008/generate-random-strings-in-as2-or-as3/#comments</comments>
		<pubDate>Sat, 10 May 2008 23:03:57 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[ActionScript 2]]></category>
		<category><![CDATA[random Strings]]></category>
		<category><![CDATA[Strings]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2008/generate-random-strings-in-as2-or-as3/</guid>
		<description><![CDATA[I was searching for a function to generate random Strings either in AS2 or in AS3 but I couldn&#8217;t find any so I made my own using code from a typewriter effect, but I can&#8217;t seem to find the page anymore. I use this code when I load dynamic content from php and such and [...]]]></description>
			<content:encoded><![CDATA[<p>I was searching for a function to generate random Strings either in AS2 or in AS3 but I couldn&#8217;t find any so I made my own using code from a typewriter effect, but I can&#8217;t seem to find the page anymore. I use this code when I load dynamic content from php and such and I don&#8217;t want flash to cache my request. Here is an ActionScript 2 version of the code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> generateRandomString<span style="color: #66cc66;">&#40;</span>newLength:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">var</span> a:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&quot;</span>;
  <span style="color: #000000; font-weight: bold;">var</span> alphabet:<span style="color: #0066CC;">Array</span> = a.<span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">var</span> randomLetter:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;&quot;</span>;
  <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> newLength; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    randomLetter += alphabet<span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> alphabet.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>;
  <span style="color: #66cc66;">&#125;</span>
  <span style="color: #b1b100;">return</span> randomLetter;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>For the ActionScript 3 version of it I made some optimizations and I created a class with the static method in it here is the code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">package net.<span style="color: #006600;">zedia</span>.<span style="color: #006600;">utils</span><span style="color: #66cc66;">&#123;</span>
  <span style="color: #0066CC;">public</span> final <span style="color: #000000; font-weight: bold;">class</span> StringUtils<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> generateRandomString<span style="color: #66cc66;">&#40;</span>newLength:uint = <span style="color: #cc66cc;">1</span>, userAlphabet:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&quot;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">var</span> alphabet:<span style="color: #0066CC;">Array</span> = userAlphabet.<span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span>;
      <span style="color: #000000; font-weight: bold;">var</span> alphabetLength:<span style="color: #0066CC;">int</span> = alphabet.<span style="color: #0066CC;">length</span>;
      <span style="color: #000000; font-weight: bold;">var</span> randomLetters:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;&quot;</span>;
      <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:uint = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> newLength; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
        randomLetters += alphabet<span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> alphabetLength<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>;
      <span style="color: #66cc66;">&#125;</span>
      <span style="color: #b1b100;">return</span> randomLetters;
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>here is how you use it:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> net.<span style="color: #006600;">zedia</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">StringUtils</span>;
&nbsp;
<span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span>StringUtils.<span style="color: #006600;">generateRandomString</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<span style="color: #808080; font-style: italic;">//for a random string of 4 characters</span>
<span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span>StringUtils.<span style="color: #006600;">generateRandomString</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4</span>, <span style="color: #ff0000;">&quot;ROGER&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<span style="color: #808080; font-style: italic;">//for a random string of 4 characters using only the following letters: ROGER</span></pre></td></tr></table></div>

<p><a href="http://www.zedia.net/fr/2008/generer-une-chaine-de-caracteres-string-aux-hazard-en-as2-et-as3/" title="Générer une chaîne de caractères (String) aux hazard en AS2 et AS3">Cet article en Français</a></p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.zedia.net%2F2008%2Fgenerate-random-strings-in-as2-or-as3%2F&amp;layout=standard&amp;show-faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:550px; height:70px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2008/generate-random-strings-in-as2-or-as3/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>ExternalInterface Problems in ActionScript 2</title>
		<link>http://www.zedia.net/2008/externalinterface-problems-in-actionscript-2/</link>
		<comments>http://www.zedia.net/2008/externalinterface-problems-in-actionscript-2/#comments</comments>
		<pubDate>Sun, 16 Mar 2008 21:09:24 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[ActionScript 2]]></category>
		<category><![CDATA[ExternalInterface]]></category>
		<category><![CDATA[Opera]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2008/externalinterface-problems-in-actionscript-2/</guid>
		<description><![CDATA[Where I work we use a lot of Javascript because the guys doing it are quite gifted and also because I am the only member of the flash department (well designers do flash, but when it gets complicated I handle it), so it is often the case where Flash has to call a Javascript function. [...]]]></description>
			<content:encoded><![CDATA[<p>Where I work we use a lot of Javascript because the guys doing it are quite gifted and also because I am the only member of the flash department (well designers do flash, but when it gets complicated I handle it), so it is often the case where Flash has to call a Javascript function. With all of my readings I had come to the conclusion that ExternalInterface.call was the best way to access Javascript functions. I guess I was wrong&#8230;</p>
<p>Well first of all ExternalInterface works very badly with Opera (at least the ActionScript 2 version, haven&#8217;t tested the ActionScript 3 version). Searching a bit I found people saying the it worked sometimes, it worked when it wasn&#8217;t inside a mouse related event, etc. Well this isn&#8217;t very reliable.</p>
<p>Also I ran in some trouble where when the Javascript was called in the html it worked fine in all browsers, when I used ExternalInterface it worked fine in Internet Explorer, didn&#8217;t do a thing in Opera and just crashed Firefox. Well that&#8217;s nice cross-browser behavior&#8230;</p>
<p>To solve my problem, I just had to do it the good old way; getURL(&#8220;javascript:myFunction()&#8221;). For the same Javascript function (the one that crashed FireFox), it worked in all browser. I hope this all works better in AS3.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.zedia.net%2F2008%2Fexternalinterface-problems-in-actionscript-2%2F&amp;layout=standard&amp;show-faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:550px; height:70px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2008/externalinterface-problems-in-actionscript-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using Delegate to have the right scope when using TweenLite, Tweener and Events in ActionScript 2</title>
		<link>http://www.zedia.net/2008/using-delegate-to-have-the-right-scope-when-using-tweenlite-tweener-and-events-in-actionscript-2/</link>
		<comments>http://www.zedia.net/2008/using-delegate-to-have-the-right-scope-when-using-tweenlite-tweener-and-events-in-actionscript-2/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 04:59:40 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[ActionScript 2]]></category>
		<category><![CDATA[Delegate]]></category>
		<category><![CDATA[TweenLite]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2008/using-delegate-to-have-the-right-scope-when-using-tweenlite-tweener-and-events-in-actionscript-2/</guid>
		<description><![CDATA[Not so long ago I was having a bad day using Flash 8 and ActionScript 2 just after completing a project in ActionScript 3. Now this Dan Hunter dude made a comment saying I should try using this Delegate class. Well last week I thought I should give it a try so I head over [...]]]></description>
			<content:encoded><![CDATA[<p>Not so long ago I was having a <a href="http://www.zedia.net/2008/actionscript-2-and-object-oriented-programming-an-entire-day-of-trouble/" title="ActionScript 2 and Object Oriented Programming; an entire day of trouble">bad day using Flash 8 and ActionScript 2</a> just after completing a project in ActionScript 3. Now this <a href="http://www.dan-hunter.net/blog/" title="Dan Hunter" target="_blank">Dan Hunter</a> dude made a comment saying I should try using this <a href="http://dynamicflash.com/2005/02/delegate-class-refined/" title="Delegate class refined" target="_blank">Delegate class</a>. Well last week I thought I should give it a try so I head over the blog post and try to figure out what it is used for. I had heard the word Delegate before, but never quite understood it.</p>
<p>So I look at the post and it is exactly what I hate in a post; it is very technical and not quite to the point. I don&#8217;t think I am a bad programmer and I should understand stuff like that but there is something missing in the post: why should I use this class in the first place?</p>
<p>Well I am going to tell you why you should used this class; because it will give you the right scope of the function called by the delegate function. Ok, ok maybe I&#8217;m not quite clear either, but go read this article on <a href="http://www.actionscript.org/resources/articles/205/1/The-Delegate-Class/Page1.html" title="How to use the Delegate class" target="_blank">how to use the Delegate class</a> and you should understand everything. I found it while installing the new version of <a href="http://www.flashdevelop.org/community/" title="Flash Develop" target="_blank">Flash Develop</a> (beta 6). The real useful thing about the Delegate class is that it permits you to use the &#8220;this&#8221; you want inside the function you want.</p>
<p>Here is my example using events; let&#8217;s start by using a simple button on click custom event. So you make this custom button class that handle the rollover and rollout internally and when you have a onrelease event, you send an event to the class containing the button. You do so in order to keep your code clean and well organized. Here is the code you would have for the event listener inside the class that will contain the custom button:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">myCustomButton.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;click&quot;</span>, handleClick<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> handleClick<span style="color: #66cc66;">&#40;</span>evt:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span><span style="color: #66cc66;">&#123;</span>
  <span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span><span style="color: #808080; font-style: italic;">//this will actually refer to myCustomButton instead of the containing class</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>By using the Delegate class, &#8220;this&#8221; will refer to the containing class. Here is how you do it:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">myCustomButton.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;click&quot;</span>, Delegate.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, handleClick<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> handleClick<span style="color: #66cc66;">&#40;</span>evt:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span><span style="color: #66cc66;">&#123;</span>
  <span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span><span style="color: #808080; font-style: italic;">//this will refer to the containing class</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>This will save you the trouble of having to find in which scope you are and also having to use this._parent all the time.</p>
<p>Another good use of the Delegate class is when you use the onComplete argument with <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> or <a href="http://blog.greensock.com/tweenliteas2" title="TweenLite" target="_blank">TweenLite</a>. When you use the onComplete argument with both these Tweening engines, it will call the function you specify it when it will be done Tweening. With Tweener this function will be scoped to the MovieClip your doing a Tween on and with TweenLite the function will be scoped to the TweenLite Object which is not very convenient. Here is how you would use the Delegate class for these situation:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span>myCustomButton, <span style="color: #66cc66;">&#123;</span><span style="color: #0066CC;">_alpha</span>:<span style="color: #cc66cc;">100</span>, <span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;">1</span>, onComplete:Delegate.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, doNextStep<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
TweenLite.<span style="color: #006600;">to</span><span style="color: #66cc66;">&#40;</span>myCustomButton, <span style="color: #cc66cc;">1</span>, <span style="color: #66cc66;">&#123;</span><span style="color: #0066CC;">_alpha</span>:<span style="color: #cc66cc;">100</span>, onComplete:Delegate.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, doNextStep<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> doNextStep<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span><span style="color: #66cc66;">&#123;</span>
  <span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span><span style="color: #808080; font-style: italic;">//this will refer to the class containing the Tweening code</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>Well this will save me a lot of trouble. I was thinking that I was a good programmer and that experience didn&#8217;t really mean anything but these little things, like using the Delegate class to have the scope you want or know that <a href="http://blog.greensock.com/tweenliteas2" title="TweenLite" target="_blank">TweenLite</a> is faster than <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> which is faster than the Adobe Tween classes,  can only be acquired with experience and they make your days a whole lot better. This kinda is a lesson of humility.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.zedia.net%2F2008%2Fusing-delegate-to-have-the-right-scope-when-using-tweenlite-tweener-and-events-in-actionscript-2%2F&amp;layout=standard&amp;show-faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:550px; height:70px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2008/using-delegate-to-have-the-right-scope-when-using-tweenlite-tweener-and-events-in-actionscript-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ActionScript 2 and Object Oriented Programming; an entire day of trouble</title>
		<link>http://www.zedia.net/2008/actionscript-2-and-object-oriented-programming-an-entire-day-of-trouble/</link>
		<comments>http://www.zedia.net/2008/actionscript-2-and-object-oriented-programming-an-entire-day-of-trouble/#comments</comments>
		<pubDate>Thu, 03 Jan 2008 06:05:03 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[ActionScript 2]]></category>
		<category><![CDATA[Delegate]]></category>
		<category><![CDATA[OOP]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2008/actionscript-2-and-object-oriented-programming-an-entire-day-of-trouble/</guid>
		<description><![CDATA[I was back to work today after the holidays and my first day hasn&#8217;t been that fun. First of all I&#8217;m back working in ActionScript 2 after working on the cool Christmas card which was in ActionScript 3. Second, I have been trying all day to make my menu work while programming it in an [...]]]></description>
			<content:encoded><![CDATA[<p>I was back to work today after the holidays and my first day hasn&#8217;t been that fun. First of all I&#8217;m back working in ActionScript 2 after working on the cool <a target="_blank" href="http://www.twistimage.com/share2007/" title="Twist Image Share 2007">Christmas card</a> which was in ActionScript 3. Second, I have been trying all day to make my menu work while programming it in an object oriented kinda way but all my efforts have been in vain.</p>
<p> The first big problem I encountered is that even if you assign a class to a symbol in the library, if you put that symbol on the stage, it won&#8217;t use the class you assigned to it. You have to use the attachMovie method in order to make that work. Ok that&#8217;s fine I can find workaround in order to make that work.</p>
<p>Now I finally get that working the trouble is that the onRollOver and other onSomething won&#8217;t work in that class because of where it is situated (in an other class or other bug I just couldn&#8217;t find). Well I lost my whole day on that&#8230;</p>
<p>I feel it&#8217;s kinda wasteful to spend time on problems like this (in ActionScript 2) because I am not really learning something that will be useful in the long run. Anyway I don&#8217;t usually like to make post like this, because I don&#8217;t provide an answer to my problem but I really had to get this out of my system. Sorry about this, better post next time.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.zedia.net%2F2008%2Factionscript-2-and-object-oriented-programming-an-entire-day-of-trouble%2F&amp;layout=standard&amp;show-faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:550px; height:70px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2008/actionscript-2-and-object-oriented-programming-an-entire-day-of-trouble/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>onReleaseOutside in ActionScript 3</title>
		<link>http://www.zedia.net/2007/onreleaseoutside-in-actionscript-3/</link>
		<comments>http://www.zedia.net/2007/onreleaseoutside-in-actionscript-3/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 03:20:07 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[ActionScript 2]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2007/onreleaseoutside-in-actionscript-3/</guid>
		<description><![CDATA[It&#8217;s always strange to find out that something you thought was so basic in a previous version disappears in the next version. Well, that&#8217;s what happened with the onReleaseOutside event function from ActionScript 2. That is actually not a bad thing because I used it mostly with buttons so that they wouldn&#8217;t stay in the [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s always strange to find out that something you thought was so basic in a previous version disappears in the next version. Well, that&#8217;s what happened with the onReleaseOutside event function from ActionScript 2. That is actually not a bad thing because I used it mostly with buttons so that they wouldn&#8217;t stay in the down state or over state when you released outside. In ActionScript 3, as soon as you leave a button (or MovieClip or Sprite) it fires the MOUSE_OUT event so you don&#8217;t really have to watch for the onReleaseOutside event like you used too.</p>
<p>Where you still need the onReleaseOutside event is when you drag an object like the thumb of a scrollbar because you have to know when to stop the drag. The trick is to use a MOUSE_DOWN event from the object you want to drag to start you dragging process and to use the MOUSE_UP event from the stage (this is  the trick). It doesn&#8217;t really matter to use the event from the stage because the MOUSE_UP event is nearly never used and you remove the listener after it has fired to free memory. I&#8217;ll post source code about it tomorrow.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.zedia.net%2F2007%2Fonreleaseoutside-in-actionscript-3%2F&amp;layout=standard&amp;show-faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:550px; height:70px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2007/onreleaseoutside-in-actionscript-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ActionScript 3 and Events</title>
		<link>http://www.zedia.net/2007/actionscript-3-and-events/</link>
		<comments>http://www.zedia.net/2007/actionscript-3-and-events/#comments</comments>
		<pubDate>Tue, 27 Nov 2007 03:19:05 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[ActionScript 2]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[events]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2007/actionscript-3-and-events/</guid>
		<description><![CDATA[I originally thought that dispatching events in ActionScript 3 would be more complicated than in ActionScript 2. But I was wrong, I wasn&#8217;t very complicated to dispatch events in ActionScript 2, well, it&#8217;s even less complicated to do so in ActionScript 3. The thing is that version 3 of ActionScript is built around the event [...]]]></description>
			<content:encoded><![CDATA[<p>I originally thought that dispatching events in ActionScript 3 would be more complicated than in ActionScript 2. But I was wrong, I wasn&#8217;t very complicated to dispatch events in ActionScript 2, well, it&#8217;s even less complicated to do so in ActionScript 3. The thing is that version 3 of ActionScript is built around the event model. Another interesting thing is that usually your class that you&#8217;d want to dispatch an event from would have to extend EventDispatcher in order to do so, but if this class already extends Sprite or MovieClip you don&#8217;t have to extend EventDispatcher; Sprite and MovieClip are already descendant of the EventDispatcher class.  What this means is that you can call the dispatchEvent method from inside a Sprite or MovieClip extending class with no other code to write.</p>
<p>What is a bit more complicated is when you want to create a custom event. It&#8217;s not really harder but the thing you have to know is that you have to override the clone and toString method. Once you&#8217;ve done that you&#8217;re ready to dispatch your own events. I&#8217;ll post an example about that soon.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.zedia.net%2F2007%2Factionscript-3-and-events%2F&amp;layout=standard&amp;show-faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:550px; height:70px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2007/actionscript-3-and-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Composition vs Inheritance</title>
		<link>http://www.zedia.net/2007/composition-vs-inheritance/</link>
		<comments>http://www.zedia.net/2007/composition-vs-inheritance/#comments</comments>
		<pubDate>Thu, 22 Nov 2007 02:10:07 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[design patterns]]></category>
		<category><![CDATA[ActionScript 2]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Design Paterns]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2007/composition-vs-inheritance/</guid>
		<description><![CDATA[I have been reading a lot these days about composition and inheritance. Inheritance is a pretty easy concept to grasp; composition on the other side is a bit more complicated. I have read quite a bit and I found much more advocates of composition than of inheritance. At least, with all this reading, i finally [...]]]></description>
			<content:encoded><![CDATA[<p>I have been reading a lot these days about composition and inheritance. Inheritance is a pretty easy concept to grasp; composition on the other side is a bit more complicated. I have read quite a bit and I found much more advocates of composition than of inheritance. At least, with all this reading, i finally understood what interfaces were used for. I started looking on the subject because I had 2 problems, my first one in ActionScript 2 where I had 4 symbols all using the same base class. This worked good until I had to import that swf into another swf. Than it was as if Flash was using an older version of my swf. My second problem in ActionScript 3, I was working on a button class using 2 symbol on the stage. All these button were to use the same code so I wanted to extend another class; no can&#8217;t do because it cannot find definition for the symbols on stage in the superclass&#8230; Well I think I am going to use composition for the latest problem, but I haven&#8217;t found a solution for the first one&#8230;</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.zedia.net%2F2007%2Fcomposition-vs-inheritance%2F&amp;layout=standard&amp;show-faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:550px; height:70px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2007/composition-vs-inheritance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SEO and Flash part 2</title>
		<link>http://www.zedia.net/2007/seo-and-flash-part-2/</link>
		<comments>http://www.zedia.net/2007/seo-and-flash-part-2/#comments</comments>
		<pubDate>Sat, 10 Nov 2007 23:31:54 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[SEO]]></category>
		<category><![CDATA[Actionscrip 3]]></category>
		<category><![CDATA[ActionScript 2]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[SWFObject]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2007/seo-and-flash-part-2/</guid>
		<description><![CDATA[In the previous article I said my tutorial about search engine optimization was going to be in 2 parts, well it&#8217;s going to be in 3 parts. In this part, I&#8217;ll explain the brute force way of making what we did the last time even better and I&#8217;ll explain the motivation behind it. Remember that [...]]]></description>
			<content:encoded><![CDATA[<p>In the previous article I said my tutorial about search engine optimization was going to be in 2 parts, well it&#8217;s going to be in 3 parts. In this part, I&#8217;ll explain the brute force way of making what we did the last time even better and I&#8217;ll explain the motivation behind it.</p>
<p>Remember that in part 1 I said that one of the most important factor in search engine optimization was what is inside the title tag. Well the easy way of making you flash website be present in search engines didn&#8217;t really optimize that factor; we used it a bit but not to its full potential. Also there is something else I didn&#8217;t speak about; the description meta tag. This tag is not a factor to be well ranked in search engine, but it can definitely be a reason why the user will click on your link on the Google page or any search engine&#8217;s page. The description meta tag define the paragraph of text that will be displayed below the link in the search engine search result page. Having a good and precise description can really help get users to your website. Lastly, if somebody searched for an expression that is present in your flash website but it is really far in and not that easy to find, in our previous method, the user will have to search trough your site to find it and might leave before even finding it.</p>
<p>Ok, so the previous method was that we dumped all the text present in the swf file in the html page embedding it. This was fine, but not really optimal as I have explained. Going from there, what the brute force is all about is dividing all the content we dumped in the first method into different html pages. For each section in the flash website, we make a page for it in Html and we embed the same swf in all pages. There are 3 particularities you have to add to make this work.</p>
<p>First, in the embedding method using SWFObject, you have to pass a variable the swf file telling it what page it is on. You can do it in this way:</p>
<pre class="prettyprint"><span class="pun">&lt;</span><span class="tag">script</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">“text/javascript”</span><span class="pln"> </span><span class="atn">src</span><span class="pun">=</span><span class="atv">“swfobject.js”</span><span class="pun">&gt;&lt;/</span><span class="tag">script</span><span class="pun">&gt;</span></pre>
<pre class="prettyprint"><span class="pln"></span><span class="pun">&lt;</span><span class="tag">script</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">“text/javascript”</span><span class="pun">&gt;</span></pre>
<pre class="prettyprint"><span class="pun">    var flashvars = {</span></pre>
<pre class="prettyprint">	page : "WRITEYOURPAGEHERE"</pre>
<pre class="prettyprint"><span class="pun">    };</span><span class="pln">
    swfobject</span><span class="pun">.</span><span class="pln">embedSWF</span><span class="pun">(</span><span class="str">“myContent.swf”</span><span class="pun">,</span><span class="pln"> </span><span class="str">“myContent”</span><span class="pun">,</span><span class="pln"> </span><span class="str">“300″</span><span class="pun">,</span><span class="pln"> </span><span class="str">“120″</span><span class="pun">,</span><span class="pln"> </span><span class="str">“9.0.0″, "expressInstall.swf", flashvars</span><span class="pun">);</span></pre>
<pre class="prettyprint"><span class="pun"></span><span class="pln">
</span><span class="pun">&lt;/</span><span class="tag">script</span><span class="pln">&gt;</span></pre>
<p>So now the swf files knows what page it is on, but it has to do something with it. When the flash loads it has to check in ActionScript for the variable that was passed to it in our case _root.page and display the good content section according to it.</p>
<p>The last thing you have to do is in the alternative content, make a link menu that links all html pages you created. This menu has to be in every html page of your site. You have to do this so that search engines spiders can access all your pages and index them.</p>
<p>What we did with this method is create multiples entry pages to your flash website instead of just one. Also this enables us to give a different title and description to each page which optimize those factors. With all this said, I can now explain why I call this the brute force method; this is not yet the best method to optimize your website for search engines. It will give you the same results as the next method, but will require more time as is harder to maintain since when you make a change in content in the flash file, you also have to do the same modification in the html page. The good point is that this method doesn&#8217;t require any server side scripting like php or asp.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.zedia.net%2F2007%2Fseo-and-flash-part-2%2F&amp;layout=standard&amp;show-faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:550px; height:70px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2007/seo-and-flash-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New FlashDevelop beta version</title>
		<link>http://www.zedia.net/2007/new-flashdevelop-beta-version/</link>
		<comments>http://www.zedia.net/2007/new-flashdevelop-beta-version/#comments</comments>
		<pubDate>Fri, 02 Nov 2007 02:10:01 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[FlashDevelop]]></category>
		<category><![CDATA[Actionscrip 3]]></category>
		<category><![CDATA[ActionScript 2]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2007/new-flashdevelop-beta-version/</guid>
		<description><![CDATA[This is just to tell you that there is a new version of the beta of FlashDevelop 3(ActionScript editor). There wasn&#8217;t any change since august 25th. I didn&#8217;t try it yet, but I soon will, it can only be better.]]></description>
			<content:encoded><![CDATA[<p>This is just to tell you that there is a new version of the beta of <a href="http://www.flashdevelop.org" title="FlashDevelop" target="_blank">FlashDevelop</a> 3(ActionScript editor). There wasn&#8217;t any change since august 25th. I didn&#8217;t try it yet, but I soon will, it can only be better.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.zedia.net%2F2007%2Fnew-flashdevelop-beta-version%2F&amp;layout=standard&amp;show-faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:550px; height:70px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2007/new-flashdevelop-beta-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
