<?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>[mck] &#187; flashdevelop</title>
	<atom:link href="http://www.matthijskamstra.nl/blog/index.php/tag/flashdevelop/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.matthijskamstra.nl/blog</link>
	<description>a polymath zapper</description>
	<lastBuildDate>Fri, 27 Jan 2012 22:32:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>FDT and ANT &#8211; part 1</title>
		<link>http://www.matthijskamstra.nl/blog/index.php/2010/07/07/fdt-and-ant-part-1/</link>
		<comments>http://www.matthijskamstra.nl/blog/index.php/2010/07/07/fdt-and-ant-part-1/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 09:57:30 +0000</pubDate>
		<dc:creator>Matthijs Kamstra</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[FDT]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[ANT-Build-template]]></category>
		<category><![CDATA[ANT-file]]></category>
		<category><![CDATA[ANT-snippets]]></category>
		<category><![CDATA[ANT-View]]></category>
		<category><![CDATA[flashdevelop]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.matthijskamstra.nl/blog/?p=1441</guid>
		<description><![CDATA[Just started to work with FDT and wrote about my &#8220;troubles&#8221; (post#1 and post#2) with my transition from FlashDevelop. (have to be very carefull what I say: &#8220;they&#8221; are watching me: here and here ) And it seems to be a very natural (geeky) thing to learn about ANT. And where do you go to [...]]]></description>
			<content:encoded><![CDATA[<p>Just started to work with <a href="http://www.fdt.powerflasher.com/">FDT</a> and wrote about my &#8220;troubles&#8221; (<a href="http://www.matthijskamstra.nl/blog/index.php/2010/06/16/moving-from-flashdevelop-to-fdt/">post#1</a> and <a href="http://www.matthijskamstra.nl/blog/index.php/2010/06/29/missing-in-fdt-after-working-with-flashdevelop/">post#2</a>) with my transition from <a href="http://www.flashdevelop.org/wikidocs/index.php?title=Main_Page">FlashDevelop</a>.<br />
<em>(have to be very carefull what I say: &#8220;they&#8221; are watching me: <a href="http://www.matthijskamstra.nl/blog/index.php/2010/06/29/missing-in-fdt-after-working-with-flashdevelop/#comment-11773">here</a> and <a href="http://twitter.com/BrunoFonzi/statuses/17355312899" class="broken_link">here</a> <img src='http://www.matthijskamstra.nl/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  )<br />
</em><br />
And it seems to be a very natural (geeky) thing to learn about <a href="http://ant.apache.org/" target="_blank">ANT</a>.</p>
<p>And where do you go to learn about ANT and SWF/Flash/FDT? (<a href="http://www.google.com/search?q=fdt+ant" target="_blank">Google</a>?)<br />
After some tinkering all I got was: <code><strong>failed to create task or type fdt.launch.application</strong></code></p>
<p>This post was very useful: <a href="http://blog.alanklement.com/2009/08/10/fdt-and-ant-a-users-guide-part-i/">FDT and ANT | A User’s Guide – Part I</a> by Alan Klement.<br />
Watch the videos (I&#8217;m not very fond of tutorial videos but in this case; they get the job done).<br />
What I love about the &#8220;<a href="http://blog.alanklement.com/files/videos/ant_part_one.mov">Video I: Getting Started</a>&#8221; is the fact that it builds up from scratch. So watch this video when you want to know about ant-files/xml, how to open the ANT-View, how to open/execute an ANT-file.</p>
<p>The second video (<a href="http://blog.alanklement.com/files/videos/ant_part_two.mov">Video II: Compiling a SWF</a>) was what I really was looking for: how to export a SWF. Very nice because it starts from scratch.<br />
And it gave me the answer I was looking for: why didn&#8217;t my ANT-file didn&#8217;t work (it about 3/4 of the video):<br />
<code><br />
BUILD FAILED<br />
[blabla]\source\a\example\build\build.xml:17: Problem: <strong>failed to create task or type fdt.launch.application</strong><br />
Cause: The name is undefined.<br />
Action: Check the spelling.<br />
Action: Check that any custom tasks/types have been declared.<br />
Action: Check that any
<presetdef>/<macrodef> declarations have taken place.<br />
</code></p>
<p><strong>Solution is very simple</strong>, but if you don&#8217;t know, you will hate FDT and really it&#8217;s not it fault:<br />
Goto the green &#8220;play&#8221; button with the brown bag, in the toolbar (one picture says more than a thousand words:)<br />
<img src="http://www.matthijskamstra.nl/blog/wp-content/uploads/external_tools_configurations_hoover.png" alt="" title="external_tools_configurations_hoover" width="229" height="142" class="alignnone size-full wp-image-1444" /></p>
<p>Select the ANT-file you want to change (I have only one <img src='http://www.matthijskamstra.nl/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ), goto to tab &#8220;<strong>JRE</strong>&#8221; and change the <strong>Runtime JRE</strong> to <strong>Run in the same JRE as the workspace</strong> and your done:<br />
<a href="http://www.matthijskamstra.nl/blog/wp-content/uploads/external_tools_configurations.png" target="_blank"><img src="http://www.matthijskamstra.nl/blog/wp-content/uploads/external_tools_configurations.png" alt="" title="external_tools_configurations" width="500" class="alignnone size-full wp-image-1445" /></a></p>
<p>Very useful are the ANT-snippets and ANT-Build-template!<br />
<a href="http://blog.alanklement.com/files/zip/ant_templates.zip">Download</a> (created by Alan Klement) and &#8220;install&#8221; the ANT-template (how-to on <a href="http://blog.alanklement.com/2009/08/10/fdt-and-ant-a-users-guide-part-i/">this page</a> but here the short version)</p>
<blockquote><p>
To add XML files templates go: <strong>Preferences > XML > XML Files > Editor > Templates</strong> and click import.</p>
<p>To add Ant snippets go: <strong>Preferences > Ant > Editor > Templates</strong> and click import.</p></blockquote>
<p>I haven&#8217;t seen the second part of this tutorial: <a href="http://blog.alanklement.com/2009/08/19/fdt-ant-part-two/">FDT and ANT | A User’s Guide – Part II</a> but I will.<br />
It seems to be focused on the use of the templates and snippets.</p>
<p>source:<br />
<a href="http://blog.alanklement.com/2009/08/10/fdt-and-ant-a-users-guide-part-i/">FDT and ANT | A User’s Guide – Part I</a><br />
<a href="http://blog.alanklement.com/2009/08/19/fdt-ant-part-two/">FDT and ANT | A User’s Guide – Part II</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthijskamstra.nl/blog/index.php/2010/07/07/fdt-and-ant-part-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://blog.alanklement.com/files/videos/ant_part_one.mov" length="15458577" type="video/quicktime" />
<enclosure url="http://blog.alanklement.com/files/videos/ant_part_two.mov" length="17294254" type="video/quicktime" />
		</item>
		<item>
		<title>Missing in FDT after working with FlashDevelop</title>
		<link>http://www.matthijskamstra.nl/blog/index.php/2010/06/29/missing-in-fdt-after-working-with-flashdevelop/</link>
		<comments>http://www.matthijskamstra.nl/blog/index.php/2010/06/29/missing-in-fdt-after-working-with-flashdevelop/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 08:29:19 +0000</pubDate>
		<dc:creator>Matthijs Kamstra</dc:creator>
				<category><![CDATA[FDT]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[flashdevelop]]></category>

		<guid isPermaLink="false">http://www.matthijskamstra.nl/blog/?p=1430</guid>
		<description><![CDATA[I love FlashDevelop but moved to FDT (read my other post about this subject)&#8230; Not an easy thing (the biggest problem is that it totally not intuitive ) to do and I&#8217;m missing some stuff that I had in FlashDevelop. CTRL+U to change the selected text to uppercase Update #1: I have found it: ToUpperCase [...]]]></description>
			<content:encoded><![CDATA[<p>I love FlashDevelop but moved to FDT (<a href="http://www.matthijskamstra.nl/blog/index.php/2010/06/16/moving-from-flashdevelop-to-fdt/">read my other post about this subject</a>)&#8230;<br />
Not an easy thing (the biggest problem is that it totally not intuitive ) to do and I&#8217;m missing some stuff that I had in FlashDevelop.</p>
<p><strong>CTRL+U</strong> to change the selected text to uppercase<br />
<img src="http://www.matthijskamstra.nl/blog/wp-content/uploads/screenshot_flashd_uppercase.png" alt="" title="Screenshot FlashDevelop &quot;to uppercase&quot;" width="506" height="343" class="alignnone size-full wp-image-1434" /></p>
<div class="update"><strong>Update #1:</strong> I have found it:<br />
ToUpperCase = CTRL+SHIFT+X<br />
ToLowerCase = CTRL+SHIFT+Y
</div>
<p><strong>CTRL+SHIFT+1</strong> to &#8220;Promote member to class&#8221;<br />
<img src="http://www.matthijskamstra.nl/blog/wp-content/uploads/screenshot_flashd_promote.png" alt="" title="Screenshot FlashDevelop &quot;Promote to class member&quot;" width="375" height="109" class="alignnone size-full wp-image-1433" /><br />
(there is a similar way to do this in FDT but not the same)</p>
<p><strong>CTRL+SHIFT+Q</strong> to create a block comment<br />
It is in FDT but I can&#8217;t get it to work so you have to work with <strong>CTRL+7</strong> (toggle comment) which is a minor adjustment.</p>
<p>The auto-completing FlashDevelop is awesome!! With some tinkering (<a href="http://blog.flashmech.net/2008/10/fdt-tip-boost-your-code-assist/">info here</a>) you can get FDT in the same room but it&#8217;s still not the same. I&#8217;m used to write private variable with a prefix &#8220;_&#8221; (example: <code>_variableName</code>). When I want the variable name to autocomplete in FlashDevelop I just type <code>variableName</code> (without the &#8220;_&#8221; prefix because it stupidly positioned on the keyboard) and it will find it. In FDT you need to start with the prefix &#8220;_&#8221; otherwise it will ignore the variable name&#8230; why??? </p>
<p>Also missing: Explore (Open &#8220;Project Manager&#8221; and right-click on a folder)<br />
<img src="http://www.matthijskamstra.nl/blog/wp-content/uploads/screenshot_flashd_explore.png" alt="" title="Screenshot FlashDevelop &quot;Explore&quot;" width="209" height="289" class="alignnone size-full wp-image-1438" /> (can&#8217;t find it in FDT)</p>
<p>But I shouldn&#8217;t complain, there is a reason why I&#8217;m changing to FDT</p>
<p>Big plus from FDT:<br />
<strong>CTRL+SHIFT+F</strong> to Format code which is not possible in Flashdevelop<br />
SWC Browsing is limited in FlashDevelop<br />
Cross Platform: FlashDevelop works only on Windows<br />
Refactor: this is so awesome (and expensive!!!)</p>
<p>source:<br />
<a href="http://blog.flashmech.net/2008/08/review-fdt-vs-flashdevelop/">http://blog.flashmech.net/2008/08/review-fdt-vs-flashdevelop/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthijskamstra.nl/blog/index.php/2010/06/29/missing-in-fdt-after-working-with-flashdevelop/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Moving from FlashDevelop to FDT</title>
		<link>http://www.matthijskamstra.nl/blog/index.php/2010/06/16/moving-from-flashdevelop-to-fdt/</link>
		<comments>http://www.matthijskamstra.nl/blog/index.php/2010/06/16/moving-from-flashdevelop-to-fdt/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 10:27:46 +0000</pubDate>
		<dc:creator>Matthijs Kamstra</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[FDT]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[flashdevelop]]></category>
		<category><![CDATA[Templates]]></category>

		<guid isPermaLink="false">http://www.matthijskamstra.nl/blog/?p=1417</guid>
		<description><![CDATA[Yes, its time, I need to&#8230; So how to make the transition from FlashDevelop to FDT as easy as possible? Let FDT react like FlashDevelop And I don&#8217;t even have to break a sweat: the amazing Steven Sacks (creator of Gaia) wrote an article about it: read here. The only two thing that I&#8217;m using [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, its time, I need to&#8230;<br />
So how to make the transition from FlashDevelop to FDT as easy as possible?</p>
<h3>Let FDT react like FlashDevelop</h3>
<p>And I don&#8217;t even have to break a sweat: the amazing <a href="http://www.stevensacks.net/">Steven Sacks</a> (creator of Gaia) wrote an article about it: <a href="http://www.stevensacks.net/2010/04/30/setting-up-fdt-to-look-and-behave-like-flashdevelop/">read here</a>.<br />
The only two thing that I&#8217;m using are:<br />
Open <strong>Window > Preferences</strong> </p>
<p>Under <strong>FDT > Editor > Code Assist</strong> copy and paste this into Auto activation triggers for AS, and set the delay to 0ms (zero).</p>
<div class="showcode">
<pre>
abcdefghijklmnopqrstuvwxyz_. :</pre>
</div>
<p>and</p>
<p>Under <strong>Problems > AS3 Problems</strong>:<br />
<strong>Unresolvable</strong> > <strong>Unresolvable variable reference in E4X</strong> and <strong>Unresolvable member reference in dynamic object</strong> should both be set to Disabled (from Warning to Disabled).</p>
<p>The shortcuts I just left them as they where: I&#8217;m working in another program so I should use the shortcut given by that program.</p>
<div class="update"><strong>Update #1:</strong> hmmm I noticed that I can&#8217;t live without CTRL+ENTER&#8230;. explanation here: <a href="http://cote.cc/blog/using-ctrl-enter-to-compile-actionscript-code-in-fdt">Using CTRL-ENTER to compile ActionScript code in FDT</a>. So now I have CTRL+ENTER and debug run:  CTRL+SHIFT+ENTER  <img src='http://www.matthijskamstra.nl/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  </p>
<p>short explanation (so I can do this quickly if something happens to FDT):</p>
<p>Under <strong>Preferences > Run/Debug > Launching</strong> at the bottom at <strong>Launch Operation</strong>: Select &#8220;<strong>Always launch the previously launched application</strong>&#8221;</p>
<p>then </p>
<p>Under <strong>Preferences > General > Keys</strong> find (or type in &#8220;type filter text&#8221; &#8211; searchbox: &#8220;last&#8221;) a command called &#8220;<strong>Run Last Launched</strong>&#8221; and click Copy Command. Assign (binding) the shortcut CTRL-ENTER to the copied command and change &#8220;when&#8221; to <strike><strong>Editing ActionScipt Source</strong> (no spelling mistake: it really says that)</strike> <strong>Editing ActionScript Source</strong>.<br />
Do the same thing for the &#8220;<strong>Debug Last Launched</strong>&#8221; command and assign the shortcut : CTRL-SHIFT-ENTER and change the when to <strong>Editing ActionScipt Source</strong>.</p>
<p><strike>I&#8217;m not sure if the stuff I wrote here is only for FDT4 but the way it was explained on the site previous mentioned didn&#8217;t work in FDT4</strike>
</div>
<h3>Some templates/snippets that are very useful</h3>
<p>I used <a href="http://www.double-quotes.com/fd/dq.htm">this plugin</a> for my trace in FlashDevelop, so how to do this in FDT?</p>
<div class="update"><strong>Update #2:</strong> I shouldn&#8217;t forget to mention CTRL+0 (read the <a href="http://www.fdt.powerflasher.com/developer-tools/fdt-3/getting-started/shortcuts/">shortcut list for FDT</a>) which is the shortcut for &#8220;Quick Trace&#8221;. This one I use to trace variable for example and the trace template below for functions.</div>
<div class="update"><strong>Update #4:</strong> This is really a reminder for myself, but if you need it you know where you can find it in FDT4.<br />
Some minor adjustments like: </p>
<p><strong>Preferences > FDT > Build Path </strong> change <strong>Source folders</strong> to &#8220;source&#8221; (I like source above src) and <strong>Output folder</strong> to &#8220;deploy&#8221; (I like deploy above bin)</p>
<p><strong>Preferences > FDT > Code Style > Code Templates (Misc)</strong> to &#8220;<strong>Override System UserName &#8211; ${user}</strong>&#8221;</p>
<p><strong>Preferences > FDT > Editor</strong> goto &#8220;Folding&#8221; and uncheck &#8220;Folding enabled&#8221; (I like to see everything, comment also)</p>
<p><strong>Preferences > FDT > Tools > Flash/Flash Help</strong> to add paths to Flash (in my case: &#8220;H:\Program Files\Adobe\Adobe Flash CS4\Flash.exe&#8221;) and the Flash help files (in my case: &#8220;H:\Program Files\Adobe\Adobe Flash CS4\en\First Run\HelpPanel\Help&#8221;)</p>
<p><strong>Preferences > General > Web Browser</strong> change to &#8220;Use external Web browser&#8221; to my favourite browser: Firefox <strike>(no Google Chrome there yet)</strike><br />
You can add any browser that you want.
</div>
<div class="update"><strong>Update #5:</strong> visit <a href="http://www.rumblingskies.com/blog/?p=75">http://www.rumblingskies.com/blog/?p=75</a> and add FTP capabilities to ANT.</div>
<p>You have to create a code-template/code-snippet:<br />
go to <strong>Preferences > FDT > Editor > Templates</strong></p>
<p>This is a template that resembles the trace I used in FlashDevelop<br />
<strong>Trace:</strong></p>
<div class="showcode">
<pre>trace ( "+ ${enclosing_type}.${enclosing_method}() - args: " + [ ${enclosing_method_arguments} ] );</pre>
</div>
<p>and I found some other useful templates</p>
<p><strong>Public method:</strong></p>
<div class="showcode">
<pre>public function ${methodName}():${type} {
    trace(">> ${enclosing_type}.${methodName}() args: "+[]);
    ${cursor}
};</pre>
</div>
<p>for some strange reason there is no shortcut for asdoc <img src='http://www.matthijskamstra.nl/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p><strong>ASDoc:</strong></p>
<div class="showcode">
<pre>/**
 * ${cursor}
 * @example
 * @param		${enclosing_method_arguments}
 * @return
 */
 */</pre>
</div>
<div class="update"><strong>Update #3:</strong> (sadly if there are no param in the function &#8220;${enclosing_method_arguments}&#8221; will be printed..)</div>
<p>a switch a use a lot with FlashDevelop:</p>
<p><strong>Switch:</strong></p>
<div class="showcode">
<pre>switch (${value}) {
	case ${result}:
		trace ("${result}" +${result} );
		${cursor}
		break;
    default:
        trace("case '"+${value}+"':\r\ttrace ('--- "+${value}+"');\r\tbreak;" );
}
</pre>
</div>
<p>and the template for a singleton</p>
<p><strong>Singleton:</strong> (from <a href="http://www.gskinner.com/blog/archives/2006/07/as3_singletons.html">gskinner</a>)</p>
<div class="showcode">
<pre>package ${enclosing_package} {

	/**
	* @author ${user}
	*/
	public class ${enclosing_type} {

		private static var _instance:${enclosing_type};
		private static var _allowInstantiation:Boolean;

		public static function getInstance():${enclosing_type} {
			if (_instance == null) {
				_allowInstantiation = true;
				_instance = new ${enclosing_type}();
				_allowInstantiation = false;
			}
			return _instance;
		}

		public function ${enclosing_type}():void {
			if (!_allowInstantiation) {
				throw new Error("Error: Instantiation failed: Use ${enclosing_type}.getInstance() instead of new.");
			}
		}

		${cursor}

	} // end class

} // end package</pre>
</div>
<p>enough for now, here some other posts about the subject</p>
<p><strong>Source:</strong><br />
<a href="http://blog.hydrotik.com/2007/11/19/fdt-30-code-templates/">http://blog.hydrotik.com/2007/11/19/fdt-30-code-templates/</a><br />
<a href="http://www.breaktrycatch.com/useful-fdt-templates/">http://www.breaktrycatch.com/useful-fdt-templates/</a><br />
<a href="http://www.stevensacks.net/2010/04/30/setting-up-fdt-to-look-and-behave-like-flashdevelop/">http://www.stevensacks.net/2010/04/30/setting-up-fdt-to-look-and-behave-like-flashdevelop/</a><br />
<a href="http://www.gskinner.com/blog/archives/2006/07/as3_singletons.html">http://www.gskinner.com/blog/archives/2006/07/as3_singletons.html</a><br />
<a href="http://blog.flashmech.net/2008/08/review-fdt-vs-flashdevelop/">http://blog.flashmech.net/2008/08/review-fdt-vs-flashdevelop/</a><br />
<a href="https://fosswiki.liip.ch/display/FLASH/Code+Snippets+for+FDT+and+Flex">https://fosswiki.liip.ch/display/FLASH/Code+Snippets+for+FDT+and+Flex</a><br />
<a href="http://cote.cc/blog/using-ctrl-enter-to-compile-actionscript-code-in-fdt">http://cote.cc/blog/using-ctrl-enter-to-compile-actionscript-code-in-fdt</a><br />
<a href="http://www.fdt.powerflasher.com/developer-tools/fdt-3/getting-started/shortcuts/">http://www.fdt.powerflasher.com/developer-tools/fdt-3/getting-started/shortcuts/</a><br />
<a href="http://blog.flashmech.net/2008/10/fdt-tip-boost-your-code-assist/">http://blog.flashmech.net/2008/10/fdt-tip-boost-your-code-assist/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthijskamstra.nl/blog/index.php/2010/06/16/moving-from-flashdevelop-to-fdt/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>My first AIR app: SWF2GIF-banner &#8211; part 1</title>
		<link>http://www.matthijskamstra.nl/blog/index.php/2009/08/12/my-first-air-app-swf2gif-banner-part-1/</link>
		<comments>http://www.matthijskamstra.nl/blog/index.php/2009/08/12/my-first-air-app-swf2gif-banner-part-1/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 08:00:53 +0000</pubDate>
		<dc:creator>Matthijs Kamstra</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[animated gif]]></category>
		<category><![CDATA[flashdevelop]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[SWF]]></category>

		<guid isPermaLink="false">http://www.matthijskamstra.nl/blog/?p=1040</guid>
		<description><![CDATA[Sometimes, and I&#8217;m not very fond of them, I need to make banners&#8230;.. The animation part is not so bad, but making the different sizes&#8230;. that can be a drag. And after you made the SWF banners, you also need to make the animation in GIF. This is how I use to do it: make [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes, and I&#8217;m not very fond of them, I need to make banners&#8230;..<br />
The animation part is not so bad, but making the different sizes&#8230;. that can be a drag.<br />
And after you made the SWF banners, you also need to make the animation in GIF.</p>
<p>This is how I use to do it: </p>
<ol>
<li>make the SWF banner</li>
<li>embed it in a html page with a background color that is not in the banner itself (a border around the SWF banner helps)</li>
<li>make snapshots of the animation</li>
<li>open photoshop >> (I used a action for this part&#8230;.)</li>
<li>place all the images in one document</li>
<li>cut the browser from the screenshot</li>
<li>select the background-color reverse the selection and cut</li>
<li>make a animation from all the layers (end photoshop action)</li>
<li>save</li>
</ol>
<p>I have never made an AIR application but I think that it should be possible to make a SWF2GIF converter in AIR.</p>
<p>Stuff what I need to find out:</p>
<ul>
<li>browse for a file</li>
<li>load that file into air</li>
<li>take snapshots of the animation</li>
<li>controle the frame rate of the animation</li>
<li>make a animated gif </li>
<li>save everything</li>
<li>etc.</li>
</ul>
<p><strong>Lets start with some basic:</strong><br />
I&#8217;m still working on CS3, and it seems that AIR default is installed with CS4<br />
Installing the Adobe AIR update for Flash CS3</p>
<p>English: <a href="http://help.adobe.com/en_US/AIR/1.5/devappsflash/WS5b3ccc516d4fbf351e63e3d118666ade46-7fc3.html" class="broken_link">http://help.adobe.com/en_US/AIR/1.5/devappsflash/WS5b3ccc516d4fbf351e63e3d118666ade46-7fc3.html</a><br />
Dutch: <a href="http://help.adobe.com/nl_NL/AIR/1.5/devappsflash/WS5b3ccc516d4fbf351e63e3d118666ade46-7fc3.html">http://help.adobe.com/nl_NL/AIR/1.5/devappsflash/WS5b3ccc516d4fbf351e63e3d118666ade46-7fc3.html</a></p>
<p>You can also use FlashDevelop 3.0.1, AIR is also installed with that program and in combination with Flex sdk you don&#8217;t even need Flash.</p>
<p>Because I&#8217;m not finished with it (I will only work on it when I have to build banners) I will post now and then some parts of the code.</p>
<p>For some reason I couldn&#8217;t find the code to load SWF into AIR using &#8220;browse&#8221;.</p>
<p>[as light="false" wraplines="true"]<br />
private function openSwfFile(e:MouseEvent = null):void<br />
{<br />
	var imagesFilter:FileFilter = new FileFilter(&quot;Flash SWF&quot;, &quot;*.swf&quot;);<br />
	myFile = new File();<br />
	myFile.addEventListener(Event.SELECT, selectHandler);<br />
	myFile.browseForOpen(&quot;Open&quot;, [imagesFilter]);<br />
}</p>
<p>private function selectHandler(event:Event):void<br />
{<br />
	myFile.removeEventListener(Event.SELECT, selectHandler);<br />
	loadSWF(myFile.url);<br />
}</p>
<p>private function loadSWF(inName:String):void<br />
{<br />
	trace( &quot;Main.loadSWF &gt; inName : &quot; + inName );<br />
	mLoader = new Loader();<br />
	mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);<br />
	mLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onErrorComplete);<br />
	mLoader.load(new URLRequest(inName));<br />
}<br />
private function onLoaderComplete(e:Event):void { startOnEnterFrameHandler(); }<br />
private function onErrorComplete(e:IOErrorEvent):void { trace( &quot;Main.onErrorComplete &gt; e : &quot; + e ); }</p>
<p>private function startOnEnterFrameHandler():void<br />
{<br />
	_movie.addChild(mLoader);<br />
	// _movie.addEventListener(Event.ENTER_FRAME , onEnterFrameHandler);<br />
}<br />
[/as]<br />
just use a button to activate.</p>
<p>I know the code is not complete&#8230; and that some classes have strange names&#8230; it&#8217;s work in progress.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthijskamstra.nl/blog/index.php/2009/08/12/my-first-air-app-swf2gif-banner-part-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FlashDevelop 3.0.0 released</title>
		<link>http://www.matthijskamstra.nl/blog/index.php/2009/06/17/flashdevelop-3-0-0-released/</link>
		<comments>http://www.matthijskamstra.nl/blog/index.php/2009/06/17/flashdevelop-3-0-0-released/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 20:23:05 +0000</pubDate>
		<dc:creator>Matthijs Kamstra</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Open source / Freeware]]></category>
		<category><![CDATA[Tools of the trade]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[actionscript 2]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[AS2]]></category>
		<category><![CDATA[flashdevelop]]></category>
		<category><![CDATA[FlashDeveloper]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[SE|PY]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.matthijskamstra.nl/blog/?p=1035</guid>
		<description><![CDATA[My favorite open source project ever, FlashDevelop has released: FlashDevelop 3.0.0 RTM (English, 4MB) . I started with coding in the Flash IDE, when I realized that there are better programs to code in I started working with SE&#124;PY (ActionScript 2 only). I really loved that program, but it never made it to ActionScript 3 [...]]]></description>
			<content:encoded><![CDATA[<p>My favorite open source project ever, <a href='http://www.flashdevelop.org/wikidocs/index.php?title=Main_Page'>FlashDevelop</a> has released: FlashDevelop 3.0.0 RTM (English, 4MB) .</p>
<p>I started with coding in the Flash IDE, when I realized that there are better programs to code in I started working with SE|PY (ActionScript 2 only). I really loved that program, but it never made it to ActionScript 3 and so I tried FlashDevelop. I have never regretted it, it a beautiful piece of work and I can&#8217;t work without it.<br />
So if your pockets aren&#8217;t deep, and want to become a better AS2/AS3 programmer. you should try this program. </p>
<p>The only sad thing is that it&#8217;s Windows only.</p>
<p><img src="http://flashdevelop.org/wikidocs/images/tour/0a-interface.png" width="500px" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthijskamstra.nl/blog/index.php/2009/06/17/flashdevelop-3-0-0-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Notepad++ opens ActionScript file with Haskell syntax highlighting</title>
		<link>http://www.matthijskamstra.nl/blog/index.php/2009/05/27/notepad-opens-actionscript-file-with-haskell-syntax-highlighting/</link>
		<comments>http://www.matthijskamstra.nl/blog/index.php/2009/05/27/notepad-opens-actionscript-file-with-haskell-syntax-highlighting/#comments</comments>
		<pubDate>Wed, 27 May 2009 22:00:05 +0000</pubDate>
		<dc:creator>Matthijs Kamstra</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[flashdevelop]]></category>
		<category><![CDATA[notepad]]></category>
		<category><![CDATA[syntax]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.matthijskamstra.nl/blog/?p=989</guid>
		<description><![CDATA[Sometimes I open ActionScript files in another editor then FlashDevelop. And in my case this is Notepad++. Notepad++ has ActionScript syntax highlighting but it seems that it doesn&#8217;t detect it. When I open an AS file it uses the Haskell syntax highlighting, and that is very annoying especially when you open a couple of files [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes I open ActionScript files in another editor then FlashDevelop. And in my case this is <a href="http://notepad-plus.sourceforge.net/uk/site.htm">Notepad++</a>.<br />
Notepad++ has ActionScript syntax highlighting but it seems that it doesn&#8217;t detect it.<br />
When I open an AS file it uses the Haskell syntax highlighting, and that is very annoying especially when you open a couple of files and you need to set them one by one to ActionScript.</p>
<p>Google (who else) provided the answer: <a href="http://cboard.cprogramming.com/general-discussions/106510-notepadplusplus-opening-actionscript-files.html">here</a>.</p>
<p>This is what you do:<br />
find and open the <code>langs.xml</code> file<br />
you can find it in the install folder of Notepad++, in my case<br />
<code>C:\Program Files\Notepad++</code></p>
<p>find the haskell language<br />
<code>< Language name="haskell" ext="hs lhs as las" commentLine="--" ></code></p>
<p>and remove &#8220;<code>as</code>&#8221; from the ext and save the file.</p>
<p>Next time you open an AS file with notepad++ it will be highlighted in the correct syntax</p>
<p> <img src='http://www.matthijskamstra.nl/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthijskamstra.nl/blog/index.php/2009/05/27/notepad-opens-actionscript-file-with-haskell-syntax-highlighting/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>TextMate AS3</title>
		<link>http://www.matthijskamstra.nl/blog/index.php/2009/04/29/textmate-as3/</link>
		<comments>http://www.matthijskamstra.nl/blog/index.php/2009/04/29/textmate-as3/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 08:00:56 +0000</pubDate>
		<dc:creator>Matthijs Kamstra</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Open source / Freeware]]></category>
		<category><![CDATA[Tools of the trade]]></category>
		<category><![CDATA[AS2]]></category>
		<category><![CDATA[developer applications]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[flashdevelop]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[SE|PY]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[TextMate]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.matthijskamstra.nl/blog/?p=853</guid>
		<description><![CDATA[I&#8217;ve been using a code-editor for years now. I started with SEPY and now I&#8217;m using FlashDevelop. Both on Windows. A colleague of mine still uses the Flash IDE (on a mac), so I decide to help him with his transition. Sadly there is no free editor for the OSX that handles AS2/AS3, but TextMate [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using a code-editor for years now. I started with SEPY and now I&#8217;m using FlashDevelop. Both on Windows.<br />
A colleague of mine still uses the Flash IDE (on a mac), so I decide to help him with his transition.</p>
<p>Sadly there is no free editor for the OSX that handles AS2/AS3, but TextMate is not very expensive and very lightweight. So I decide that TextMate would be the programme that would get him out of Flash IDE editor.</p>
<p>With a little help of <a href="http://www.google.nl/search?q=textmate+as3">Google</a> (I haven&#8217;t used a mac for about 7 years) I found some help/instructions that are easy to follow. Sadly it didn&#8217;t work while I followed the instruction to the letter. </p>
<p>While you start reading the post below, start downloading <a href="http://www.adobe.com/products/flex/flexdownloads/index.html" class="broken_link">Flex 3.2 SDK</a>, it&#8217;s 118Mb but you&#8217;ll need it later on so why not start downloading it now.</p>
<p>Start reading here: <a href="http://blog.simongregory.com/10/textmate-actionscript-3-and-flex-bundles/">textmate actionscript 3 and flex bundles</a>, it&#8217;s about the files you will use. But besides being informative, I needed more help.<br />
I found that here: <a href="http://www.pixelate.de/blog/setting-up-a-as3-project-in-textmate">setting up a as3 project in textmate</a>, the same steps will be followed here</p>
<ol>
<li>Download <a href="http://www.macromates.com/">Textmate</a> (duh), if you want to test this, use the trail version.</li>
<li>Download <a href="http://www.adobe.com/products/flex/flexdownloads/index.html" class="broken_link">Flex 3.2 SDK</a> and extract it into your <code>Developer/SDKs</code> folder (but there are more places where you can extract it: just read this, for example <code>/Applications/Flex</code> and <code>/Developer/Applications/Flex</code> is also allowed)</li>
<li>Subversion: follow the instructions from the tutorial: its very easy (read also the note at the bottom of the post)</li>
<li>ActionScript 3 bundle from subversion: I can repeat myself: follow the instructions (to get the Terminal: Apple + space and type Terminal and get it from the list)</li>
<li>This you <strong>don&#8217;t</strong> have to do: in the new Flex 3.2 SDK it&#8217;s already included</li>
<li>I didn&#8217;t install this either and it worked just fine</li>
<li>It seems that this is not necesarry anymore (perhaps there was an update of the AS3 bundle&#8230;). But if you need it: Follow the instructions, but for the <code>TM_FLEX_FILE_SPECS    src/Main.as</code> and <code>TM_FLEX_OUTPUT        deploy/Main.swf</code> I needed some help because what ever I did, I couldn&#8217;t get the described window.<br />
I found my answer in this:</p>
<blockquote><p>That’s a little hidden. With nothing selected in the project drawer, click on the little i at the bottom. You’ll get a box to enter any variables you want for the project.</p></blockquote>
<p><em><a href="http://noahlittle.wordpress.com/2007/09/09/flex-and-actionscript-3-with-textmate-and-fcsh/">source</a></em></p>
<p>And this one was very frustrating:<strike> <code>TM_FLEX_PATH    Developer/SDKs/Your Flex SDK Folder</code></strike>: this one needed an extra slash <code>TM_FLEX_PATH    /Developer/SDKs/Your Flex SDK Folder</code> and in my case it was <code>TM_FLEX_PATH    /Developer/SDKs/flex_sdk_3</code></p>
<p>Note: Some of this is not necessary when you create a project instead of separate files: File >> New From Templates >> Actionscript 3 >> Project. Just check TM_FLEX_PATH if you installed flex in file that standard is read by Textmate. If not you need to fill it as described above (I needed to do that)
</li>
<li>The same as in the tutorial</li>
<li>The same as in the tutorial</li>
</ol>
<div class="update">If you extract the Flex SDK, you will get a folder named &#8220;<code>flex_sdk_3</code>&#8221; and the very observant reader will notice that the script used here doesn&#8217;t include the path &#8220;<code>Developer/SDKs/flex_sdk_3</code>&#8220;, so that is the reason you need to add it to the &#8220;shell variables&#8221; (number 7). You can also rename the folder to &#8220;<code>flex_sdk_3.2.0</code>&#8221; and then I don&#8217;t think you need to add it to the shell variables, but I haven&#8217;t tested it!</div>
<p>Some extra information: svn is something that not everybody will use. So if you have no idea what it is, the bundle can also be installed without subversion. But the cool thing about subversion stuff is that it&#8217;s always up to date&#8230; (And I can&#8217;t help you with how you should fix it without svn)</p>
<div class='highlight'>Every blog mentions the price of Textmate: &#8220;single user license (€39 ? $53)&#8221;. That&#8217;s not expensive; unless you live in the Netherlands: &#8220;single user license (€48.75)&#8221; because we need to pay &#8220;Prices above include 25% VAT.&#8221; <img src='http://www.matthijskamstra.nl/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  </div>
<p>Links in this tutorial:<br />
<a href="http://blog.simongregory.com/10/textmate-actionscript-3-and-flex-bundles/">textmate actionscript 3 and flex bundles</a><br />
<a href="http://www.adobe.com/products/flex/flexdownloads/index.html" class="broken_link">Flex 3.2 SDK</a><br />
installing as3 and flex bundle for textmate.<br />
<a href="http://noahlittle.wordpress.com/2007/09/09/flex-and-actionscript-3-with-textmate-and-fcsh/">flex and actionscript 3 with textmate and fcsh</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthijskamstra.nl/blog/index.php/2009/04/29/textmate-as3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>FlashDevelop 3.0.0 RC2 released</title>
		<link>http://www.matthijskamstra.nl/blog/index.php/2009/03/17/flashdevelop-300-rc2-released/</link>
		<comments>http://www.matthijskamstra.nl/blog/index.php/2009/03/17/flashdevelop-300-rc2-released/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 15:19:14 +0000</pubDate>
		<dc:creator>Matthijs Kamstra</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Open source / Freeware]]></category>
		<category><![CDATA[Tools of the trade]]></category>
		<category><![CDATA[flashdevelop]]></category>

		<guid isPermaLink="false">http://www.matthijskamstra.nl/blog/?p=909</guid>
		<description><![CDATA[I said it before: I don&#8217;t like to regurgitate, but program is so good that I can&#8217;t help myself&#8230;. As we are now approaching the final release of FlashDevelop 3, this release is the last feature release. FlashDevelop.org &#8211; View topic &#8211; FlashDevelop 3.0.0 RC2 released. FlashDevelop is awesome! If you never used it, give [...]]]></description>
			<content:encoded><![CDATA[<p>I said it <a href="http://www.matthijskamstra.nl/blog/index.php/2008/08/27/flashdevelop-300-beta8-released/">before</a>: I don&#8217;t like to regurgitate, but program is so good that I can&#8217;t help myself&#8230;.</p>
<blockquote><p>As we are now approaching the final release of FlashDevelop 3, this release is the last feature release.</p></blockquote>
<p><a href='http://www.flashdevelop.org/community/viewtopic.php?f=11&#038;t=4374'>FlashDevelop.org &#8211; View topic &#8211; FlashDevelop 3.0.0 RC2 released</a>.</p>
<p>FlashDevelop is awesome! If you never used it, give it a try. And don&#8217;t be afraid that it&#8217;s not a final version: I&#8217;ve been using release 3.0.0 from the early beta, and never run into major bugs.</p>
<p><a href="http://www.flashdevelop.org/wikidocs/index.php?title=Main_Page">FlashDevelop documentation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthijskamstra.nl/blog/index.php/2009/03/17/flashdevelop-300-rc2-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Document Class in AS3</title>
		<link>http://www.matthijskamstra.nl/blog/index.php/2009/02/11/document-class-in-as3/</link>
		<comments>http://www.matthijskamstra.nl/blog/index.php/2009/02/11/document-class-in-as3/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 08:00:10 +0000</pubDate>
		<dc:creator>Matthijs Kamstra</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[AS3 migration]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[actionscript 2]]></category>
		<category><![CDATA[compiler errors]]></category>
		<category><![CDATA[document class]]></category>
		<category><![CDATA[flashdevelop]]></category>
		<category><![CDATA[library symbol]]></category>
		<category><![CDATA[programmers]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.matthijskamstra.nl/blog/?p=794</guid>
		<description><![CDATA[A while back a read this post about the AS3 Pills #1 &#8211; Document class and it reminded me to write something about the &#8220;Document Class&#8221;. The title of this post is a little misleading: there is no &#8220;Document Class&#8221; in Actionscript 2 but this is probably the way you are searching for this problem. [...]]]></description>
			<content:encoded><![CDATA[<p>A while back a read this post about the <a href="http://www.fuoridalcerchio.net/wordpress/2008/12/17/as3pills-01/" class="broken_link">AS3 Pills #1 &#8211; Document class</a> and it reminded me to write something about the &#8220;Document Class&#8221;. The title of this post is a little misleading: there is no &#8220;Document Class&#8221; in Actionscript 2 but this is probably the way you are searching for this problem.</p>
<p>A good explanation can be found on <a href="http://www.kirupa.com/forum/showthread.php?p=1950401">kirupa.com</a> which has a ton of examples, explanations and tutorials!</p>
<p>But this is what it comes down to:</p>
<ol>
<li>create a folder with the name &#8220;Matthijs tutorials&#8221; (or use your own name, it&#8217;s not important)</li>
<li>create in the folder &#8220;Matthijs tutorials&#8221;, another folder &#8220;source&#8221;</li>
<li>save a flash file in the &#8220;source&#8221; folder: &#8220;documentClassTest.fla&#8221;</li>
<li>now we start making <code>packages</code>: create a folder &#8220;nl&#8221;</li>
<li>and save in folder &#8220;nl&#8221; a folder &#8220;matthijskamstra &#8220;</li>
</ol>
<div id="attachment_821" class="wp-caption aligncenter" style="width: 328px"><a href="http://www.matthijskamstra.nl/blog/wp-content/uploads/flashdevelop_folderstructure.jpg"><img src="http://www.matthijskamstra.nl/blog/wp-content/uploads/flashdevelop_folderstructure.jpg" alt="Folder structure (FlashDevelop)" title="flashdevelop_folderstructure" width="318" height="228" class="size-full wp-image-821" /></a><p class="wp-caption-text">Folder structure (FlashDevelop)</p></div>
<p>Goto Adobe Flash, and create a AS3 Flash file and save it in the <code>source</code> folder.</p>
<p>Fill in the document Class: <code>nl.matthijskamstra.Main</code><br />
<em>(Flash will complain somewhat, you can ignore it for now&#8230;)</em></p>
<div id="attachment_820" class="wp-caption aligncenter" style="width: 686px"><a href="http://www.matthijskamstra.nl/blog/wp-content/uploads/documentclass.jpg"><img src="http://www.matthijskamstra.nl/blog/wp-content/uploads/documentclass.jpg" alt="Document Class" title="Document Class" width="676" height="111" class="size-full wp-image-820" /></a><p class="wp-caption-text">Document Class</p></div>
<p>Create a new class in the folder <code>matthijskamstra</code>, default (at least the default <a href="http://www.flashdevelop.org/">Flashdevelop</a> class) it will look something like this.<br />
[as]<br />
package nl.matthijskamstra {</p>
<p>	/**<br />
	 * @author Matthijs Kamstra aka [mck]<br />
	 */<br />
	public class Main {</p>
<p>		public function Main ()  {</p>
<p>		}</p>
<p>	} // end class</p>
<p>} // end package<br />
[/as]</p>
<p>If you would compile the .FLA now you will get an error (Compiler Errors):</p>
<blockquote><p>Location: Main.as, Line 1<br />
Description: 5000: The class &#8216;nl.matthijskamstra.Main&#8217; must subclass &#8216;flash.display.MovieClip&#8217; since it is linked to a library symbol of that type.</p></blockquote>
<p><em>(if you compile using flex you will get this error)<br />
</em><br />
<blockquote>Error #2023: Class Main$ must inherit from Sprite to link to the root.</p></blockquote>
<p>The first time I got this error I couldn&#8217;t understand it, luckily I do now and the answer isn&#8217;t that difficult, but if you don&#8217;t know&#8230; <img src='http://www.matthijskamstra.nl/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<ul>
<li><strong>The class &#8216;nl.matthijskamstra.Main&#8217; must subclass &#8216;flash.display.MovieClip&#8217;</strong>: the class that we just made needs to extend (be a subclass) of Movieclip (the root has a timeline)</li>
<li><strong>since it is linked to a library symbol of that type</strong>: this is strange, this says that the class is linked to a library symbol. This what puzzled me the most: I (we) didn&#8217;t link this to a library item, we linked it to the document class. The Flex error helps more, but you can see the root as a very big movie (timeline) and let the error be the error.</li>
<li><strong>Error #2023: Class Main$ must inherit from Sprite to link to the root.</strong>: why does flex say you need a to extend Sprite? Flex programmers don&#8217;t use the timeline and a Sprite is a Movieclip with just one frame.</li>
</ul>
<p>So to sum things up: there are some stuff that you need to do with a document class that you don&#8217;t have to do to an other class:<br />
First you need to extend it to Sprite or MovieClip. If you create more then one frame in the timeline you need to extend to MovieClip because MovieClip supports frames and Sprite doesn&#8217;t. I always choose to extend to MovieClip, because it covers all the bases&#8230; (a Sprite is a MovieClip with just one frame: a Sprite is not a MovieClip but a MovieClip is a Sprite)</p>
<p><em>Another error that seems to happen sometime (not if you use the default class from FlashDevelop)</em><br />
Second a document class should be public (the constructor is always public).<br />
A Constructor is a function or method that is called whenever the Class (in our case the document class) gets instantiated, it must never have a return type such as &#8220;void&#8221;</p>
<p>Don&#8217;t forget you need to import the MovieClip class: <code>import flash.display.MovieClip;</code> (see the error created by Flash)</p>
<p>So the Document Class looks now something like this:</p>
<p>[as]<br />
package nl.matthijskamstra {</p>
<p>	import flash.display.MovieClip;</p>
<p>	/**<br />
	 * @author Matthijs Kamstra aka [mck]<br />
	 */<br />
	public class Main extends MovieClip {</p>
<p>		// constructor<br />
		public function Main ()  {<br />
			trace( &#8220;Main.Main&#8221; );<br />
			init ();<br />
		}</p>
<p>		private function init ():void  {<br />
			trace( &#8220;Main.init&#8221; );<br />
		}		</p>
<p>	} // end class</p>
<p>} // end package<br />
[/as]</p>
<p>Export you Flash file and you will have two traces in you output panel</p>
<p>My default class looks similar, I add two group-imports:</p>
<pre><code>
import flash.display.*;
import flash.events.*;
</code></pre>
<p>with the &#8220;*&#8221; you import everything in that package (MovieClip, Sprite, etc)<br />
because AS3 is event based, I import everything in the events-package</p>
<p>[as]<br />
package nl.matthijskamstra {</p>
<p>	import flash.display.*;<br />
	import flash.events.*;</p>
<p>	/**<br />
	 * @author Matthijs Kamstra aka [mck]<br />
	 */<br />
	public class Main extends MovieClip {</p>
<p>		// constructor<br />
		public function Main ()  {<br />
			trace( &#8220;Main.Main&#8221; );<br />
			init ();<br />
		}</p>
<p>		private function init ():void  {<br />
			trace( &#8220;Main.init&#8221; );<br />
		}		</p>
<p>	} // end class</p>
<p>} // end package<br />
[/as]</p>
<p>That&#8217;s it, I hope this clears the mystery called Document Class<br />
Questions? You know where to place them!</p>
<p><strong>Linkdump:</strong><br />
<em>another post that I never finished, but it fits here&#8230;</em></p>
<p><a href='http://blog.andrewpaulsimmons.com/2007/07/referenceerror-error-1056-caused-by.html'>Andrew Paul Simmons: Blog: ReferenceError: Error #1056: Caused by Declaring Stage Instances Private</a>.</p>
<p>Ever got this error:<br />
<href="http://www.google.nl/search?q=ReferenceError%3A+Error+%231056%3A+Cannot+create+property>ReferenceError: Error #1056: Cannot create property</a>? No, then someone has explained it to you before you made this mistake.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.matthijskamstra.nl/blog/index.php/2009/02/11/document-class-in-as3/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Hello box2D &#8211; part 4</title>
		<link>http://www.matthijskamstra.nl/blog/index.php/2009/01/15/hello-box2d-part-4/</link>
		<comments>http://www.matthijskamstra.nl/blog/index.php/2009/01/15/hello-box2d-part-4/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 08:00:32 +0000</pubDate>
		<dc:creator>Matthijs Kamstra</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[box2d]]></category>
		<category><![CDATA[box2dFlash]]></category>
		<category><![CDATA[flashdevelop]]></category>

		<guid isPermaLink="false">http://www.matthijskamstra.nl/blog/?p=783</guid>
		<description><![CDATA[In my previous post I update the &#8220;Hello world&#8221; for box2D so that you can see something visual interesting. You can find the original here: AS3: Hello Box2D. Today I will post the same code but now how it should be. Keeping the coding conventions in mind and making it easier to reuse code. Still [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://www.matthijskamstra.nl/blog/index.php/2009/01/13/hello-box2d-part-3hello-box2d-part-3/" class="broken_link">previous post</a> I update the &#8220;Hello world&#8221; for box2D so that you can see something visual interesting.<br />
You can find the original here: <a href="http://www.box2d.org/wiki/index.php?title=Manual/AS3#Hello_Box2D">AS3: Hello Box2D</a>.</p>
<p>Today I will post the same code but now how it should be.<br />
Keeping the <a href="http://opensource.adobe.com/wiki/display/flexsdk/Coding+Conventions">coding conventions</a> in mind and making it easier to reuse code.</p>
<p>Still keeping in mind the original <a href="http://www.box2d.org/wiki/index.php?title=Manual/AS3#Hello_Box2D">Hello world</a></p>
<p>[as]<br />
package {</p>
<p>	import flash.display.*;<br />
	import flash.events.*;<br />
	// Box2D Classes used in this &#8220;Hello world&#8221;<br />
	import Box2D.Dynamics.*;<br />
	import Box2D.Collision.*;<br />
	import Box2D.Collision.Shapes.*;<br />
	import Box2D.Common.Math.*;</p>
<p>	//[SWF(width="640", height="480", backgroundColor="#000000", frameRate="60")]<br />
	public class HelloWorld extends MovieClip {</p>
<p>		public var world:b2World;<br />
		public var iterations:int 		= 10;<br />
		public var timeStep:Number 		= 1.0 / 60.0;<br />
		public var worldScale:Number 	= 30.0;</p>
<p>		// to see what you have created<br />
		private var debugDraw:b2DebugDraw;<br />
		private var isDebugDrawing:Boolean = true;	// change to false and there is no debugDraw</p>
<p>		// constructor<br />
		public function HelloWorld() {<br />
			//trace( &#8220;HelloWorld.HelloWorld&#8221; );<br />
			init();<br />
		}</p>
<p>		/**<br />
		 * lets start building our &#8220;Hello world&#8221; box2D program<br />
		 */<br />
		private function init():void {<br />
			trace( &#8220;HelloWorld.init&#8221; );</p>
<p>			createWorld();<br />
			creatingGroundBox();<br />
			creatingDynamicBody();</p>
<p>			setupDebugDraw();</p>
<p>			// Add event for main loop<br />
			addEventListener(Event.ENTER_FRAME, onUpdateHandler, false, 0, true);<br />
		}</p>
<p>		/**<br />
		 * http://www.box2d.org/wiki/index.php?title=Manual/AS3#Creating_a_World<br />
		 */<br />
		private function createWorld():void {<br />
			// Creat world AABB<br />
			var worldAABB:b2AABB = new b2AABB();<br />
			worldAABB.lowerBound.Set(-100.0, -100.0);<br />
			worldAABB.upperBound.Set(100.0, 100.0);</p>
<p>			// Define the gravity vector<br />
			var gravity:b2Vec2 = new b2Vec2 (0.0, -10.0); </p>
<p>			// Allow bodies to sleep<br />
			var doSleep:Boolean = true;</p>
<p>			// Construct a world object<br />
			world = new b2World(worldAABB, gravity, doSleep);<br />
		}</p>
<p>		/**<br />
		 * http://www.box2d.org/wiki/index.php?title=Manual/AS3#Creating_a_Ground_Box<br />
		 */<br />
		private function creatingGroundBox():void {<br />
			var groundBodyDef:b2BodyDef = new b2BodyDef();<br />
			groundBodyDef.position.Set(0.0, -9.0);</p>
<p>			var groundBody:b2Body = world.CreateBody(groundBodyDef);</p>
<p>			var groundShapeDef:b2PolygonDef = new b2PolygonDef();<br />
			groundShapeDef.SetAsBox(50.0, 10.0);</p>
<p>			groundBody.CreateShape(groundShapeDef);<br />
		}</p>
<p>		/**<br />
		 * http://www.box2d.org/wiki/index.php?title=Manual/AS3#Creating_a_Dynamic_Body<br />
		 */<br />
		private function creatingDynamicBody ():void {<br />
			var bodyDef:b2BodyDef = new b2BodyDef();<br />
			bodyDef.position.Set(10.0, 10.0);<br />
			var body:b2Body = world.CreateBody(bodyDef);</p>
<p>			var shapeDef:b2PolygonDef = new b2PolygonDef();<br />
			shapeDef.SetAsBox(1.0, 1.0);<br />
			shapeDef.density = 1.0;<br />
			shapeDef.friction = 0.3;<br />
			shapeDef.restitution = 0.8;<br />
			body.CreateShape(shapeDef);<br />
			body.SetMassFromShapes();</p>
<p>		}</p>
<p>		// extra to visualize<br />
		private function setupDebugDraw():void {<br />
			if(isDebugDrawing) {<br />
				debugDraw = new b2DebugDraw();<br />
				debugDraw.m_sprite = new Sprite();</p>
<p>				addChild(debugDraw.m_sprite);</p>
<p>				debugDraw.m_drawScale = 30;<br />
				debugDraw.m_fillAlpha = .25;<br />
				debugDraw.m_lineThickness = 1;<br />
				debugDraw.m_drawFlags = b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit ;<br />
				world.SetDebugDraw (debugDraw);<br />
			}<br />
		}</p>
<p>		/**<br />
		 * http://www.box2d.org/wiki/index.php?title=Manual/AS3#Simulating_the_World_.28of_Box2D.29<br />
		 */<br />
		public function onUpdateHandler(e:Event):void{<br />
			world.Step(timeStep, iterations);<br />
		}</p>
<p>	} // end class</p>
<p>} // end package<br />
[/as]</p>
<p>So all you need to do is CTRL+ENTER.</p>
<p>And you will have something like this:</p>
<div class="flash">
<object width="520" height="390">
<param name="movie" value="http://www.matthijskamstra.nl/blog/wp-content/uploads/helloworldbox2d_nice.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowScriptAccess" value="always"></param>
<embed type="application/x-shockwave-flash" width="520" height="390" src="http://www.matthijskamstra.nl/blog/wp-content/uploads/helloworldbox2d_nice.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.matthijskamstra.nl/blog/index.php/2009/01/15/hello-box2d-part-4/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

