<?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>eingko weblog &#187; Flash</title>
	<atom:link href="http://www.eingko.net/blog/category/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.eingko.net/blog</link>
	<description>a web developer's thoughts and musings</description>
	<lastBuildDate>Wed, 09 Dec 2009 23:42:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>TweenLite Version 11 Rocks My Socks!</title>
		<link>http://www.eingko.net/blog/2009/10/29/tweenlite-version-11-rocks-my-socks/</link>
		<comments>http://www.eingko.net/blog/2009/10/29/tweenlite-version-11-rocks-my-socks/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 20:07:49 +0000</pubDate>
		<dc:creator>eingko</dc:creator>
				<category><![CDATA[Et Cetera]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.eingko.net/blog/?p=39</guid>
		<description><![CDATA[Jack Doyle is a genius (Grant Skinner also deserves mention, a genius in his own right). TweenLite (and TweenMax, and TweenNano, and Tween&#8230;) proves, yet again, that it is the best ActionScript tweening engine in the world. I haven&#8217;t been this excited about a tweening engine in a while. Check out the new features of [...]]]></description>
			<content:encoded><![CDATA[<p>Jack Doyle is a genius (<a href="http://www.gskinner.com/">Grant Skinner</a> also deserves mention, a genius in his own right). <a href="http://blog.greensock.com/">TweenLite</a> (and TweenMax, and TweenNano, and Tween&#8230;) proves, yet again, that it is the best ActionScript tweening engine in the world. I haven&#8217;t been this excited about a tweening engine in a while. Check out the <a href="http://blog.greensock.com/v11/">new features of TweenLite</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eingko.net/blog/2009/10/29/tweenlite-version-11-rocks-my-socks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Framework 1.7 Now Available</title>
		<link>http://www.eingko.net/blog/2008/11/21/zend-framework-17-now-available/</link>
		<comments>http://www.eingko.net/blog/2008/11/21/zend-framework-17-now-available/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 22:38:24 +0000</pubDate>
		<dc:creator>eingko</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.eingko.net/blog/?p=35</guid>
		<description><![CDATA[Zend Framework 1.7 has been released!
Here&#8217;s what I&#8217;m excited about:

Zend_Amf with support for AMF0 and AMF3 protocols
Performance enhancements in Zend_Loader, Zend_Controller, and server components
File transfer enhancements
&#8220;In addition, almost three hundred bugs have been fixed&#8221;

Download it today!
]]></description>
			<content:encoded><![CDATA[<p>Zend Framework 1.7 has been <a href="http://devzone.zend.com/article/4045-Zend-Framework-1.7.0-is-now-available">released</a>!</p>
<p>Here&#8217;s what I&#8217;m excited about:</p>
<ul>
<li>Zend_Amf with support for AMF0 and AMF3 protocols</li>
<li>Performance enhancements in Zend_Loader, Zend_Controller, and server components</li>
<li>File transfer enhancements</li>
<li>&#8220;In addition, almost three hundred bugs have been fixed&#8221;</li>
</ul>
<p><a href="http://framework.zend.com/download/latest">Download it today</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eingko.net/blog/2008/11/21/zend-framework-17-now-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Internet Explorer, Flash, Alignment Gotcha</title>
		<link>http://www.eingko.net/blog/2008/11/19/internet-explorer-flash-alignment-gotcha/</link>
		<comments>http://www.eingko.net/blog/2008/11/19/internet-explorer-flash-alignment-gotcha/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 21:16:15 +0000</pubDate>
		<dc:creator>eingko</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[XHTML/CSS]]></category>

		<guid isPermaLink="false">http://www.eingko.net/blog/?p=33</guid>
		<description><![CDATA[I ran into a rather annoying issue the other day related to content alignment in Flash; as usual, this problem exists exclusively in Internet Explorer. To be more specific, it is an issue with how the Flash Player ActiveX control is written.
If you are aligning content in Flash that uses the Stage width or height [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into a rather annoying issue the other day related to content alignment in Flash; as usual, this problem exists exclusively in Internet Explorer. To be more specific, it is an issue with how the Flash Player ActiveX control is written.</p>
<p>If you are aligning content in Flash that uses the Stage width or height as a variable (e.g., you want to center a MovieClip) and you do it on initialization (i.e., in code and on the first frame), you may run in to this issue.  Here is an image demonstrating what you might see:</p>
<p><img src="http://www.eingko.net/blog/wp-content/uploads/2008/11/ie_flash_bug.gif" alt="" title="Internet Explorer, Flash, Alignment Gotcha" width="400" height="440" class="alignleft size-full wp-image-34" style="border: none;" /></p>
<p>Note that in the &#8220;before&#8221; screen, the content is centered horizontally, while in the &#8220;after&#8221; screen, the content is only half-visible and appears to be &#8220;centered&#8221; on the left margin.</p>
<p>If you run a test &#8211; output the Stage width to a text field, you&#8217;ll see that the width will be returned as 0.</p>
<p>As far as I know, there are two solutions to this problem.  If you&#8217;re embedding your Flash using swfObject, then make sure that you omit the &#8220;scale&#8221; attribute. For example, modify the following:</p>
<pre class="code">
var params = {
    bgcolor: "#000000",
    menu: "false",
    scale: "noScale",
    allowFullScreen: true
};
</pre>
<p>To something that looks like this:</p>
<pre class="code">
var params = {
    bgcolor: "#000000",
    menu: "false",
    allowFullScreen: true
};
</pre>
<p>Alternatively, if you absolutely need that attribute.  You can create an &#8220;EnterFrame&#8221; event listener that detects when the Stage width is greater than 0 and then remove the listener.  Here&#8217;s an example in ActionScript 2:</p>
<pre class="code">
this.onEnterFrame = function() {
    if (Stage.width > 0) {
        init(); // Pass to initialization function
        this.onEnterFrame = null; // Clear enterFrame listener
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.eingko.net/blog/2008/11/19/internet-explorer-flash-alignment-gotcha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Framework &amp; Flash</title>
		<link>http://www.eingko.net/blog/2008/07/30/zend-framework-flash/</link>
		<comments>http://www.eingko.net/blog/2008/07/30/zend-framework-flash/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 14:47:15 +0000</pubDate>
		<dc:creator>eingko</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.eingko.net/blog/?p=31</guid>
		<description><![CDATA[Here&#8217;s a quick little &#8220;gotcha&#8221; when using the Zend PHP Framework:
If you plan on using Flash at all (i.e., SWF or FLV files) be sure to append the necessary extensions the .htaccess file in the &#8220;public&#8221; folder to the rewrite rule:
RewriteEngine On
RewriteRule !\.(js&#124;ico&#124;gif&#124;jpg&#124;png&#124;css&#124;swf&#124;flv)$ index.php
Note the added &#8220;swf&#8221; and &#8220;flv&#8221; extensions.  Otherwise access to these [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick little &#8220;<a href="http://en.wikipedia.org/wiki/Gotcha_(programming)">gotcha</a>&#8221; when using the <a href="http://framework.zend.com/">Zend PHP Framework</a>:</p>
<p>If you plan on using Flash at all (i.e., SWF or FLV files) be sure to append the necessary extensions the .htaccess file in the &#8220;public&#8221; folder to the rewrite rule:</p>
<pre class="code">RewriteEngine On
RewriteRule !\.(js|ico|gif|jpg|png|css<strong>|swf|flv</strong>)$ index.php</pre>
<p>Note the added &#8220;swf&#8221; and &#8220;flv&#8221; extensions.  Otherwise access to these files will return an error.  Firebug (if you use it) will say that the files are being loaded (<a href="http://www.w3.org/Protocols/HTTP/HTRESP.html">200 OK</a>), but if you look at the response, it&#8217;s the error page not the actually requested file that is being returned.</p>
<p>Granted, this isn&#8217;t exclusive to the Zend Framework &#8211; it&#8217;s a result of the <a href="http://www.htaccess-guide.com/">.htaccess configuration</a> (regardless of which framework/engine you use); but it&#8217;s just something to keep in mind.</p>
<p><strong>Update:</strong></p>
<p>Here&#8217;s a better declaration (via: <a href="http://framework.zend.com/manual/en/zend.application.quick-start.html">http://framework.zend.com/manual/en/zend.application.quick-start.html</a>):</p>
<p><code>RewriteEngine On<br />
RewriteCond %{REQUEST_FILENAME} -s [OR]<br />
RewriteCond %{REQUEST_FILENAME} -l [OR]<br />
RewriteCond %{REQUEST_FILENAME} -d<br />
RewriteRule ^.*$ - [NC,L]<br />
RewriteRule ^.*$ index.php [NC,L]</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.eingko.net/blog/2008/07/30/zend-framework-flash/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>ActionScript 2.0 NetStream Annoyance</title>
		<link>http://www.eingko.net/blog/2008/05/21/actionscript-20-netstream-annoyance/</link>
		<comments>http://www.eingko.net/blog/2008/05/21/actionscript-20-netstream-annoyance/#comments</comments>
		<pubDate>Wed, 21 May 2008 22:35:23 +0000</pubDate>
		<dc:creator>eingko</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.eingko.net/blog/?p=30</guid>
		<description><![CDATA[Here&#8217;s a &#8220;heads up&#8221; to anyone who may be pulling his/her hair out wondering why NetStream won&#8217;t load an FLV.  For whatever reason (I&#8217;m guessing it&#8217;s a bug), if you have a strongly-typed NetStream within a function, it will not work.
For example, the following code will work on &#8220;_root&#8221;:
var my_video:Video; // my_video is a [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a &#8220;heads up&#8221; to anyone who may be pulling his/her hair out wondering why NetStream won&#8217;t load an FLV.  For whatever reason (I&#8217;m guessing it&#8217;s a bug), if you have a strongly-typed NetStream within a function, it will not work.</p>
<p>For example, the following code will work on &#8220;_root&#8221;:</p>
<pre class="code">var my_video:Video; // my_video is a Video object on the Stage
var my_nc:NetConnection = new NetConnection();
my_nc.connect(null);
var my_ns:NetStream = new NetStream(my_nc);
my_video.attachVideo(my_ns);
my_ns.play("video1.flv");</pre>
<p>Try dropping this into a function or class and you will see that it does not work at all.  To make it work, you must completely remove the data typing and variable declaration for the NetStream and NetConnection:</p>
<pre class="code">var my_video:Video; // my_video is a Video object on the Stage
my_nc = new NetConnection();
my_nc.connect(null);
my_ns = new NetStream(my_nc);
my_video.attachVideo(my_ns);
my_ns.play("video1.flv");</pre>
<p>See Adobe&#8217;s <a href="http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&#038;file=00001589.html">LiveDocs</a> on this topic for more information.</p>
<p>I wasted far too many hours trying to figure this out thinking that the problem was with my code.  I hope I can save someone else from the same frustration.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eingko.net/blog/2008/05/21/actionscript-20-netstream-annoyance/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Why I Love ActionScript 3.0</title>
		<link>http://www.eingko.net/blog/2007/09/26/why-i-love-actionscript-30/</link>
		<comments>http://www.eingko.net/blog/2007/09/26/why-i-love-actionscript-30/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 16:55:39 +0000</pubDate>
		<dc:creator>eingko</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.eingko.net/blog/2007/09/26/why-i-love-actionscript-30/</guid>
		<description><![CDATA[When ActionScript 2.0 was released &#8211; and later Flash 8 &#8211; it was exciting to see the new capabilities of the Flash player.  But, the improvements of ActionScript 3.0 over ActionScript 2.0 are incredible.  When I jumped in and started playing around with ActionScript 3.0 I discovered many significant changes, all for the [...]]]></description>
			<content:encoded><![CDATA[<p>When ActionScript 2.0 was released &#8211; and later Flash 8 &#8211; it was exciting to see the new capabilities of the Flash player.  But, the improvements of ActionScript 3.0 over ActionScript 2.0 are incredible.  When I jumped in and started playing around with ActionScript 3.0 I discovered many significant changes, all for the better.  The following is a list of improvements that, for me, were exciting to see:</p>
<ul>
<li>Improved Object Oriented support (internal, public, private, and protected class types).</li>
<li>Improved event model; all events require listeners.</li>
<li>MouseEvent.MOUSE_LEAVE (detect mouse exit from stage) &#8211; enough said.</li>
<li>Performance &#8211; See <a title="PaperVision3D" target="_blank" href="http://www.papervision3d.org/">PaperVision3D</a>.</li>
<li>Improved compile-time and run-time error reporting.</li>
<li>DisplayList and MovieClip re-parenting and auto-depth management.</li>
<li>int and uint Classes for non-floated numbers.</li>
<li>XML is a built-in datatype</li>
<li>Intervals replaced with Timers</li>
<li>Built in &#8220;drawCircle&#8221; (or &#8220;drawOval&#8221;) method added for run-time elliptical shape-generation.</li>
</ul>
<p>There&#8217;s a lot more as well, but these are just a few improvements that I was very pleased to see.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eingko.net/blog/2007/09/26/why-i-love-actionscript-30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Partigen</title>
		<link>http://www.eingko.net/blog/2007/07/02/partigen/</link>
		<comments>http://www.eingko.net/blog/2007/07/02/partigen/#comments</comments>
		<pubDate>Tue, 03 Jul 2007 02:59:31 +0000</pubDate>
		<dc:creator>eingko</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.eingko.net/blog/2007/07/02/partigen/</guid>
		<description><![CDATA[I&#8217;m really excited about the upcoming release of Partigen, check it out here: http://www.desuade.com/.
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m really excited about the upcoming release of Partigen, check it out here: <a title="Desuade.com" href="http://www.desuade.com/">http://www.desuade.com/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eingko.net/blog/2007/07/02/partigen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Press SPACEBAR or ENTER to activate and use this control&#8221;</title>
		<link>http://www.eingko.net/blog/2006/04/14/press-spacebar-or-enter-to-activate-and-use-this-control/</link>
		<comments>http://www.eingko.net/blog/2006/04/14/press-spacebar-or-enter-to-activate-and-use-this-control/#comments</comments>
		<pubDate>Fri, 14 Apr 2006 22:34:57 +0000</pubDate>
		<dc:creator>eingko</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.eingko.net/blog/?p=14</guid>
		<description><![CDATA[Three days ago (April 11) Microsoft released an Internet Explorer update in response to the patent battle between Microsoft and Eolas. After installing the update, Internet Explorer (not other browsers, fortunately) users will be required to &#8220;activate&#8221; embedded objects and plug-ins before they can interact with them. Here&#8217;s what sucks, most users will receive this [...]]]></description>
			<content:encoded><![CDATA[<p>Three days ago (April 11) Microsoft released an <a title="Internet Explorer Update" href="http://support.microsoft.com/?kbid=912945">Internet Explorer update</a> in response to the patent battle between Microsoft and Eolas. After installing the update, Internet Explorer (not other browsers, fortunately) users will be required to &#8220;activate&#8221; embedded objects and plug-ins before they can interact with them. Here&#8217;s what sucks, most users will receive this update <strong>automatically</strong> via Windows Update. Embedded objects and controls affected are:</p>
<ul>
<li>Adobe  Reader</li>
<li>Apple QuickTime Player</li>
<li>Macromedia Flash</li>
<li>Microsoft Windows Media Player</li>
<li>Real Networks RealPlayer</li>
<li>Sun Java Virtual Machine</li>
</ul>
<p>In order to activate these objects, users are required to press the space bar, enter key, or use the mouse to click on the item. Anyone that&#8217;s tested the <a title="Internet Explorer 7 beta" href="http://www.microsoft.com/windows/IE/ie7/ie7betaredirect.mspx">Internet Explorer 7 beta</a> will have noticed similar behavior within that browser.  According to <a target="_blank" title="w3schools browser statistics" href="http://www.w3schools.com/browsers/browsers_stats.asp">w3schools browser statistics</a>, over 60% of web users browse using Internet Explorer, meaning within the next few days approximately 60% of visitors to Flash websites, or sites using embedded media will be required to activate the media before being able to use it; because of this, some users may assume that the website is broken.</p>
<p>Here&#8217;s the good news:  <a title="Microsoft has posted a solution" href="http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/activating_activex.asp">Microsoft has posted a solution</a> for web developers that would like to avoid their content being blocked.  Essentially, in order to avoid this problem all that a web developer needs to do is embed the object via external script files.  Those who have opted for <a title="Unobtrusive Flash Object" href="http://www.bobbyvandersluis.com/ufo/">Unobtrusive Flash Object</a> placement within their websites will not be affected, because their content is already embedded in this manner.</p>
<p>What&#8217;s ironic about this entire situation is that it actually forces developers to use a more standards compliant approach, go figure.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eingko.net/blog/2006/04/14/press-spacebar-or-enter-to-activate-and-use-this-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extending the Movieclip Class in Flash (ActionScript 2.0)</title>
		<link>http://www.eingko.net/blog/2006/03/13/extending-the-movieclip-class-in-flash-actionscript-20/</link>
		<comments>http://www.eingko.net/blog/2006/03/13/extending-the-movieclip-class-in-flash-actionscript-20/#comments</comments>
		<pubDate>Mon, 13 Mar 2006 17:44:03 +0000</pubDate>
		<dc:creator>eingko</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.eingko.net/blog/?p=11</guid>
		<description><![CDATA[In Optimizing Flash Buttons (Part 1) and (Part 2) I talked about improving the efficiency of creating movieclip buttons; although the methods/approaches discussed therein are valuable (but that&#8217;s for you to decide), sometimes a more powerful or abstract solution is required.  In the text that follows I&#8217;ll dissect a class that I&#8217;ve created that [...]]]></description>
			<content:encoded><![CDATA[<p>In Optimizing Flash Buttons <a title="Optimizing Flash Buttons (Part 1)" href="http://www.eingko.net/blog/?p=6">(Part 1)</a> and <a title="Optimizing Flash Buttons (Part 2)" href="http://www.eingko.net/blog/?p=10">(Part 2)</a> I talked about improving the efficiency of creating movieclip buttons; although the methods/approaches discussed therein are valuable (but that&#8217;s for you to decide), sometimes a more powerful or abstract solution is required.  In the text that follows I&#8217;ll dissect a class that I&#8217;ve created that takes my previous functions one step further, and eliminates the need for copying and pasting code repeatedly.  Now, let&#8217;s jump right in&#8230;</p>
<p>First, download the class contained in the .zip file &#8211; <a title="http://www.eingko.net/files/com_rtimoshenko_mcUI.zip" href="http://www.eingko.net/files/com_rtimoshenko_mcUI.zip">http://www.eingko.net/files/com_rtimoshenko_mcUI.zip</a> &#8211; and save the .as file in the following directory (you may need to create some folders):</p>
<ul>
<li>(Windows 2000 or Windows XP) \Documents and Settings\<em>user</em>\Local  Settings\Application Data\Macromedia\Flash MX 2004\<em>language</em>\Configuration\Classes\com\rtimoshenko\</li>
<li>(Macintosh OS X) Hard Drive/Users/Library/Application Support/Macromedia/Flash MX 2004/<em>language</em>/Configuration/Classes/com/rtimoshenko/</li>
</ul>
<p><strong>Note:</strong> <em>The Flash MX 2004 authoring environment (or above) is required for this class to work.  Also, if your authoring environment is Flash 8, then &#8211; obviously &#8211; your class path will be slightly different than those above.</em></p>
<p>Next, start a new Document in Flash and create a shape on the Stage.  Then convert your shape to a symbol (press F8, while the shape is selected) by opening the &#8220;Convert to Symbol&#8221; dialog box (keep it open).  Press the &#8220;Advanced&#8221; button and modify the field values within the &#8220;Linkage&#8221; fieldset to the following (see image below):</p>
<p><img title="Convert to Symbol - Linkage" alt="Convert to Symbol - Linkage" src="http://www.eingko.net/blog/blogImages/img_mcUI_01.gif" /></p>
<ul>
<li>Identifier: _opt02_mc (This can really be anything you want)</li>
<li>AS 2.0 Class: com.rtimoshenko.mcUI</li>
<li>Check &#8220;Export for actionscript&#8221;</li>
<li>Check &#8220;Export in first frame&#8221;</li>
</ul>
<p>Once the values are set, press &#8220;Okay&#8221; to continue.  Select the instance on the stage and double-click it to edit it.  Create a new layer and call it &#8220;_actions&#8221; (or whatever you want), select the first frame in your new layer and open up the <em>Actions</em> panel (press F9).  Insert the following code:</p>
<pre class="actionscript">stop();</pre>
<p>Now, create another layer and call it &#8220;_labels&#8221;.  Click on <strong>frame 2</strong> of the the &#8220;_labels&#8221; layer and in your properties panel type in the word &#8220;over&#8221; (see image below).</p>
<p><img alt="Movieclip Timeline - ui_mc" title="Movieclip Timeline - ui_mc" src="http://www.eingko.net/blog/blogImages/img_mcUI_02.gif" /></p>
<p>Now do the same for <strong>frame 11</strong>, except type in the word &#8220;out&#8221;.  Click on <strong>frame 10</strong> of the &#8220;_actions&#8221; layer and open up the <em>Actions</em> panel (press F9) and insert the following code:</p>
<pre class="actionscript">stop();</pre>
<p>Finally, create a simple shape tween so that you have a basic rollover animation. Your timeline should now look something like the image below.</p>
<p><img src="http://www.eingko.net/blog/blogImages/img_mcUI_03.gif" /></p>
<p>All that&#8217;s left is to define a path for the movieclip when it&#8217;s clicked.  Go back to the _root timeline (Scene_1) and click on the shape-cum-movieclip that we created earlier and open up your  <em>Actions</em> panel (press F9).  Insert this code:</p>
<pre class="actionscript">onClipEvent(load){
this._path = "http://www.yourwebsite.com/";
}</pre>
<p>Test your work and see the magic happen.  The nice thing about this method is that it completely eliminates copy/pasting all together.  All that&#8217;s required is to declare any particular library instance as an object of the <em>mcUI</em> class and it automatically inherits code that tells it to play &#8220;over&#8221; on rollover and &#8220;out&#8221; on rollout.  Pretty cool, eh?  Well, that&#8217;s it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eingko.net/blog/2006/03/13/extending-the-movieclip-class-in-flash-actionscript-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Optimizing Flash Buttons (Part 2)</title>
		<link>http://www.eingko.net/blog/2006/02/09/optimizing-flash-buttons-part-2/</link>
		<comments>http://www.eingko.net/blog/2006/02/09/optimizing-flash-buttons-part-2/#comments</comments>
		<pubDate>Thu, 09 Feb 2006 21:00:44 +0000</pubDate>
		<dc:creator>eingko</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.eingko.net/blog/?p=10</guid>
		<description><![CDATA[Last week I shared the method I use to optimize (movieclip) buttons within Flash.  Now, I&#8217;m going to take it one step further, by putting the following on the first frame of the topmost layer:
_global.path = "/index.php";
_global.pg_1 = _global.path + "?id=1";

function eventListener(my_mc, mcInstance){
my_mc.onRollOver = function(){
this.gotoAndPlay("over");
}
my_mc.onRollOut = function(){
this.gotoAndPlay("out");
}
my_mc.onRelease = function(){
getPage(mcInstance);
}
}

function getPage(mcInstance){
var newPage = _global["pg_" + [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I shared the method I use to optimize (movieclip) buttons within Flash.  Now, I&#8217;m going to take it one step further, by putting the following on the first frame of the topmost layer:</p>
<pre class="actionscript">_global.path = "/index.php";
_global.pg_1 = _global.path + "?id=1";

function eventListener(my_mc, mcInstance){
my_mc.onRollOver = function(){
this.gotoAndPlay("over");
}
my_mc.onRollOut = function(){
this.gotoAndPlay("out");
}
my_mc.onRelease = function(){
getPage(mcInstance);
}
}

function getPage(mcInstance){
var newPage = _global["pg_" + mcInstance];
getURL(newPage);
}</pre>
<p>Then, on each movieclip I would place:</p>
<pre class="actionscript">onClipEvent(load){
var instance = 1; // this number is different for every instance
_root.eventListener(this, _parent["_opt0" + instance + "_mc"], instance);
}</pre>
<p>By creating a function and using it instead of having repetetive <em>onRollover</em>, <em>onRollout</em> movieclip method calls we&#8217;ve reduced the likelihood of errors from repetition and made future updates quicker and more efficient.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eingko.net/blog/2006/02/09/optimizing-flash-buttons-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
