<?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>Blog » Orland Media Ltd&#187; Blog « Orland Media Ltd</title>
	<atom:link href="http://www.orlandmedia.com/blog/category/actionscript-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.orlandmedia.com/blog</link>
	<description>The blog of Orland Media Ltd</description>
	<lastBuildDate>Tue, 18 May 2010 22:35:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Passing parameters to a MouseEvent listener</title>
		<link>http://www.orlandmedia.com/blog/actionscript-3/passing-parameters-to-a-mouseevent-listener/</link>
		<comments>http://www.orlandmedia.com/blog/actionscript-3/passing-parameters-to-a-mouseevent-listener/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 14:27:05 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://www.orlandmedia.com/blog/?p=415</guid>
		<description><![CDATA[Problem:
Here is how we construct a MouseEvent handler in ActionScript 3.0:

myButton.addEventListener(MouseEvent.CLICK, openURL, false, 0, true);

private function openURL(e:MouseEvent):void
{
   navigateToURL(new URLRequest(&#34;http://www.mysite.com&#34;), &#34;_blank&#34;);
}

Note that we set the fourth parameter, useWeakReference, to true. This ensures that if this listener is the the only reference to the myButton remaining, myButton can still be garbage collected if required.
The trouble [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="Mouse Event" src="/images/mouse_event.jpg" title="Mouse Event" class="alignnone" width="450" height="80" /><br/></p>
<h4>Problem:</h4>
<p>Here is how we construct a MouseEvent handler in ActionScript 3.0:</p>
<pre class="brush: as3;">
myButton.addEventListener(MouseEvent.CLICK, openURL, false, 0, true);

private function openURL(e:MouseEvent):void
{
   navigateToURL(new URLRequest(&quot;http://www.mysite.com&quot;), &quot;_blank&quot;);
}
</pre>
<p class="announcement">Note that we set the fourth parameter, <code>useWeakReference</code>, to true. This ensures that if this listener is the the only reference to the <code>myButton</code> remaining, <code>myButton</code> can <a href="http://gskinner.com/blog/archives/2006/07/as3_weakly_refe.html">still be garbage collected</a> if required.</p>
<p>The trouble with this is that every time <code>myButton</code> is clicked, the same URL will open. We can&#8217;t easily pass a parameter to the function which is acting as a listener. How can the same function be used by many buttons to open a different URL for each button? How can we pass a parameter?</p>
<h4>Solution 1: Custom events (won&#8217;t work):</h4>
<p>It would be nice if we could dispatch a <a href="http://www.xllusion.net/ed/2008/01/21/as3-custom-event-for-passing-unlimited-parameters/">custom event</a> on mouse click. Custom events extend the event class enabling us to dispatch an event with additional properties (like a URL). This event is received by the handler then the property is accessed. The trouble is this approach won&#8217;t work here because the Flash Player automatically dispatches MouseEvents, we don&#8217;t dispatch them ourselves. (If anyone sees a way this may be done, please comment below.)</p>
<h4>Solution 2: Embed the function call (not advised):</h4>
<p>An interesting strategy is used <a href="http://cookbooks.adobe.com/post_Pass_variables_through_a_MouseEvent_Listener-16685.html">here</a>, whereby a call to a function is used as the event handler, and this returns the function to use, including the desired parameter. The trouble with this approach is that it is not really good form, in that there is no way we can reference the handler if we did want to remove it using <code>removeEventListener()</code>.</p>
<p>We&#8217;re beginning to see that there is actually no way to &#8220;pass&#8221; a parameter, really. We have to rather detect the button-specific value by &#8220;association&#8221;. The following solutions all achieve this by using the MouseEvent&#8217;s <code>target</code> property:</p>
<h4>Solution 3: Use a switch statement on the event&#8217;s target property</h4>
<p>When the button is clicked, providing there is no further mouse-enabled object inside it, that button is the event&#8217;s target. We can say it <em>dispatched</em> the event. We can access the target object that dispatched the event using a property of the event itself:</p>
<pre class="brush: as3;">
myButton.addEventListener(MouseEvent.CLICK, openURL, false, 0, true);

private function openURL(e:MouseEvent):void
{
   trace(e.target + &quot;dispatched this event!&quot;);
   navigateToURL(new URLRequest(&quot;http://www.mysite.com&quot;), &quot;_blank&quot;);
 }
</pre>
<p>If we can access the target we can decide what to do in the handler depending on the target:</p>
<pre class="brush: as3;">
myButton.addEventListener(MouseEvent.CLICK, openURL, false, 0, true);

private function openURL(e:MouseEvent):void
{
   var u:URLRequest = new URLRequest;

   switch(e.target)
   {
      case myButton:
         u.url = &quot;http://www.mysite.com&quot;;
         break;

      case myOtherButton:
         u.url = &quot;http://www.myothersite.com&quot;;
         break;

      default:
         throw new Error(&quot;No URL set for &quot; + e.target);
         return;
   }

   navigateToURL(u, &quot;_blank&quot;);
}
</pre>
<p>This works well.</p>
<h4>Solution 4: Use a public custom property inside the dispatching object</h4>
<p>We could avoid a switch statement and instead have a property inside the dispatching class which can then be detected. So if our button extends Sprite, let&#8217;s say, we could have an instance property in there called <code>url</code> and we could detect that, as follows:</p>
<pre class="brush: as3;">
myButton.addEventListener(MouseEvent.CLICK, openURL, false, 0, true);

private function openURL(e:Event):void
{
   var u:URLRequest = new URLRequest;
   navigateToURL(new URLRequest(e.target.url), &quot;_blank&quot;);
 }
</pre>
<p>This is fine too, but we might need to throw an error if the object dispatching the event doesn&#8217;t have a <code>url</code> property.</p>
<h4>Solution 5: Use a dictionary object to track variables</h4>
<p><a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/utils/Dictionary.html">Dictionary objects</a> in ActionScript are similar to associative arrays but they can accept complex objects, as opposed to strings, as their keys. After creating our button we could push a reference to it into a dictionary and specify a value to associate with it, like this:</p>
<pre class="brush: as3;">
var dict:Dictionary = new Dictionary(true);  // use weak references to the objects
var myButton:Sprite = new Sprite;
dict[myButton] = &quot;http://www.mysite.com&quot;;
addChild(myButton);

myButton.addEventListener(MouseEvent.CLICK, openURL, false, 0, true);

private function openURL(e:MouseEvent):void
{
   navigateToURL(new URLRequest(dict[e.target]), &quot;_blank&quot;);
}
</pre>
<p>This is perfectly workable too.</p>
<p>Solutions 3, 4 and 5 all seem equally good solutions to this problem. There is just one final option, which is to avoid the problem altogether by using separate listeners for each button. But that, of course, is what we were trying to solve in the first place. <img src='http://www.orlandmedia.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.orlandmedia.com/blog/actionscript-3/passing-parameters-to-a-mouseevent-listener/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Flash course in London</title>
		<link>http://www.orlandmedia.com/blog/actionscript-3/flash-course-in-london/</link>
		<comments>http://www.orlandmedia.com/blog/actionscript-3/flash-course-in-london/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 14:20:36 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://www.orlandmedia.com/blog/?p=405</guid>
		<description><![CDATA[We are tentatively scheduling our next ActionScript 3.0 training course for 17th -19th February in central London.
As a start to the new year, we&#8217;re applying a 25% discount for all trainees &#8211; and an additional 25% for those who are self funded!
If you would like to attend the course please get in touch.  
]]></description>
			<content:encoded><![CDATA[<p>We are tentatively scheduling our next <a href="http://www.orlandmedia.com/training/flash/applied_as3/">ActionScript 3.0 training course</a> for 17th -19th February in central London.</p>
<p class="announcement">As a start to the new year, we&#8217;re applying a <strong>25% discount</strong> for all trainees &#8211; and an <strong>additional 25%</strong> for those who are self funded!</p>
<p>If you would like to attend the course please <a href="/contact/">get in touch</a>. <img src='http://www.orlandmedia.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.orlandmedia.com/blog/actionscript-3/flash-course-in-london/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash ActionScript 3 course in London</title>
		<link>http://www.orlandmedia.com/blog/actionscript-3/flash-actionscript-3-course-in-london/</link>
		<comments>http://www.orlandmedia.com/blog/actionscript-3/flash-actionscript-3-course-in-london/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 12:14:50 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://www.orlandmedia.com/blog/?p=374</guid>
		<description><![CDATA[We&#8217;ve scheduled our next Applied ActionScript 3 training course for 25th-27th November here in London. The course teaches how to build a real-world application entirely using ActionScript 3.
If you&#8217;d like to attend the course please get in touch.
]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve scheduled our next <a href="http://www.orlandmedia.com/training/flash/applied_as3/">Applied ActionScript 3 training course</a> for 25th-27th November here in London. The course teaches how to build a real-world application entirely using ActionScript 3.</p>
<p>If you&#8217;d like to attend the course please <a href="http://www.orlandmedia.com/contact/">get in touch</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.orlandmedia.com/blog/actionscript-3/flash-actionscript-3-course-in-london/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arthropod Debugger</title>
		<link>http://www.orlandmedia.com/blog/actionscript-3/arthropod-debugger/</link>
		<comments>http://www.orlandmedia.com/blog/actionscript-3/arthropod-debugger/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 23:05:59 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://www.orlandmedia.com/blog/?p=361</guid>
		<description><![CDATA[Problem
You want to be able to see trace statements etc. whether your application is in Test Movie mode, running locally over HTTP or running remotely over HTTP in the browser plug-in. You don&#8217;t want to use the the Flash Debugger and you don&#8217;t want to have to install Flash Debug players. You just want to [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong></p>
<p>You want to be able to see trace statements etc. whether your application is in Test Movie mode, running locally over HTTP or running remotely over HTTP in the browser plug-in. You don&#8217;t want to use the the Flash Debugger and you don&#8217;t want to have to install Flash Debug players. You just want to see <code>trace()</code> statements &#8211; in a more aesthetically pleasing window if possible..</p>
<p><strong>Solution</strong></p>
<p><a title="Arthropod Debugger" href="http://arthropod.stopp.se/index2.php/" target="_blank"><img title="Arthropod" src="/images/blog/arthropod.jpg" alt="" width="200" height="65" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.orlandmedia.com/blog/actionscript-3/arthropod-debugger/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Why use init methods in AS3</title>
		<link>http://www.orlandmedia.com/blog/actionscript-3/why-use-init-methods-in-as3/</link>
		<comments>http://www.orlandmedia.com/blog/actionscript-3/why-use-init-methods-in-as3/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 22:43:26 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://www.orlandmedia.com/blog/?p=354</guid>
		<description><![CDATA[Checking our stats, we just saw that some people are searching for &#8220;why use init methods as3&#8243;. There are several reasons to consider using init methods in AS3, rather than have all of your initialisation code in your constructor functions:

Constructor functions run slower than &#8220;regular&#8221; methods. (See here for details.)
You might want to re-run initialisation [...]]]></description>
			<content:encoded><![CDATA[<p>Checking our stats, we just saw that some people are searching for &#8220;why use init methods as3&#8243;. There are several reasons to consider using init methods in AS3, rather than have all of your initialisation code in your constructor functions:</p>
<ul>
<li>Constructor functions run slower than &#8220;regular&#8221; methods. (See <a href="http://blog.pixelbreaker.com/flash/as30-jit-vs-interpreted/">here</a> for details.)</li>
<li>You might want to re-run initialisation code without recreating the instance.</li>
<li>You might want to run delayed initialisation code, for example once an object has been added to the Display List. (See our post <a href="http://www.orlandmedia.com/blog/actionscript-3/added_to_stage-event-fires-twice/">here</a> regarding this issue.)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.orlandmedia.com/blog/actionscript-3/why-use-init-methods-in-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>getDefinitionByName() produces ReferenceError: Error #1065: Variable is not defined</title>
		<link>http://www.orlandmedia.com/blog/actionscript-3/getdefinitionbyname-produces-referenceerror-error-1065-variable-is-not-defined/</link>
		<comments>http://www.orlandmedia.com/blog/actionscript-3/getdefinitionbyname-produces-referenceerror-error-1065-variable-is-not-defined/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 15:44:54 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://www.orlandmedia.com/blog/?p=342</guid>
		<description><![CDATA[Scenario
Something we often do here is get the &#8220;id&#8221; of a clicked menu button and instantiate a section of a site, depending on the ID passed. Usually all sections of a site inherit from a generic &#8220;Section&#8221; class, then have additional specific capabilities depending on the section. So, depending on the ID passed, we need [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Scenario</strong></p>
<p>Something we often do here is get the &#8220;id&#8221; of a clicked menu button and instantiate a section of a site, depending on the ID passed. Usually all sections of a site inherit from a generic &#8220;Section&#8221; class, then have additional specific capabilities depending on the section. So, depending on the ID passed, we need to create an instance of the particular class. This means we need to get the class name dynamically from the string passed by the button.</p>
<p>Let&#8217;s imagine the &#8220;music&#8221; button was pressed. We&#8217;ll either have a listener for this or we&#8217;ll directly call a method called <code>loadSection()</code>, passing the ID (the name of the button usually). We name instances in <a href="http://en.wikipedia.org/wiki/CamelCase">camel notation</a>, so that&#8217;ll be &#8220;music&#8221;.</p>
<p>This string goes over to the <code>loadSection()</code> method and in here we use a custom StringUtils class to covert the first letter to upper case, getting us the required class name as a string. So this gives us &#8220;Music&#8221;. A string is no good on its own though &#8211; we need to get the class reference for this, as follows:</p>
<pre class="brush: as3;">
// required &quot;dummy&quot; ref to ensure class is compiled...
var dummyRef:Music;
...
// get class reference
var classRef = getDefinitionByName(id);
// instantiate class instance as current section
section = new classRef();
</pre>
<p><strong><br />
Problem</strong></p>
<p>All well and good. The trouble is sometimes it just doesn&#8217;t work and you&#8217;ll get:</p>
<p class="output">ReferenceError: Error #1065: Variable Music is not defined</p>
<p>There&#8217;s a thread <a href="http://www.actionscript.org/forums/showthread.php3?t=188325">here</a> where the person was getting this, and it drifted off into another debate without being solved. The <code>import</code> statement is there. The dummy class reference is there, but still it doesn&#8217;t work.</p>
<p><strong><br />
Solution</strong></p>
<p>What is not immediately clear is that you need to provide a fully qualified class path to <code>getDefinitionByName()</code> &#8211; even though you have set up an import.</p>
<p>Amend as follows (for example) and your problem is solved:</p>
<pre class="brush: as3;">
// var classRef = getDefinitionByName(id);
var classRef = getDefinitionByName(&quot;sections.&quot; + id);
</pre>
<p>&#8220;sections.&#8221; here is a reference to our package structure.</p>
<p>We hope this helps you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.orlandmedia.com/blog/actionscript-3/getdefinitionbyname-produces-referenceerror-error-1065-variable-is-not-defined/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>AS3 training course</title>
		<link>http://www.orlandmedia.com/blog/actionscript-3/as3-training-course/</link>
		<comments>http://www.orlandmedia.com/blog/actionscript-3/as3-training-course/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 10:11:28 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://www.orlandmedia.com/blog/?p=302</guid>
		<description><![CDATA[Due to popular demand, we are scheduling another ActionScript training course for 26-28th August 2009, in central London.
If you would like to reserve a place please get in touch.
]]></description>
			<content:encoded><![CDATA[<p>Due to popular demand, we are scheduling another <a href="http://www.orlandmedia.com/training/flash/applied_as3/">ActionScript training course</a> for <strong>26-28th August 2009</strong>, in central London.</p>
<p>If you would like to reserve a place please <a href="/contact">get in touch</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.orlandmedia.com/blog/actionscript-3/as3-training-course/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>localToGlobal() in AS3 not working</title>
		<link>http://www.orlandmedia.com/blog/actionscript-3/localtoglobal-in-as3-not-working/</link>
		<comments>http://www.orlandmedia.com/blog/actionscript-3/localtoglobal-in-as3-not-working/#comments</comments>
		<pubDate>Wed, 13 May 2009 16:06:32 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://www.orlandmedia.com/blog/?p=277</guid>
		<description><![CDATA[localToGlobal() not working? The LiveDocs on this potentially very useful method, along with its partner globalToLocal() are not actually very helpful.
What they don&#8217;t make clear is that you need to be sure to overwrite your point when using it:

// WRONG:
var pt:Point = new Point(target.x, target.y);
target.parent.localToGlobal(pt);
parent.globalToLocal(pt);

// RIGHT:
var pt:Point = new Point(target.x, target.y);
pt = target.parent.localToGlobal(pt);
pt = parent.globalToLocal(pt);

Simply [...]]]></description>
			<content:encoded><![CDATA[<p><code>localToGlobal()</code> not working? The <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/DisplayObject.html#localToGlobal()">LiveDocs</a> on this potentially very useful method, along with its partner <code>globalToLocal()</code> are not actually very helpful.</p>
<p>What they don&#8217;t make clear is that you need to be sure to overwrite your point when using it:</p>
<pre class="brush: as3;">
// WRONG:
var pt:Point = new Point(target.x, target.y);
target.parent.localToGlobal(pt);
parent.globalToLocal(pt);

// RIGHT:
var pt:Point = new Point(target.x, target.y);
pt = target.parent.localToGlobal(pt);
pt = parent.globalToLocal(pt);
</pre>
<p>Simply running a <code>localToGlobal()</code> method on a point in a given scope is not enough. You need to write the result back into the point. You might be forgiven for not seeing this, because it was not necessary for the equivalent method in AS2!</p>
<p><code>localToGlobal()</code> and <code>globalToLocal()</code> can be the source of considerable frustration, especially as this differences such as this are not mentioned by Adobe. But properly understood these methods are not complicated. If this post helped you please let us know. <img src='http://www.orlandmedia.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.orlandmedia.com/blog/actionscript-3/localtoglobal-in-as3-not-working/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>AS3 course in July</title>
		<link>http://www.orlandmedia.com/blog/actionscript-3/as3-course-in-july/</link>
		<comments>http://www.orlandmedia.com/blog/actionscript-3/as3-course-in-july/#comments</comments>
		<pubDate>Thu, 07 May 2009 16:59:17 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://www.orlandmedia.com/blog/?p=274</guid>
		<description><![CDATA[Our next Applied ActionScript 3.0 course will more than likely be scheduled for early July, 2009.
The course is limited to only 5 delegates. If you would like to reserve a place please let us know &#8211; we&#8217;d be happy to have you there.
]]></description>
			<content:encoded><![CDATA[<p>Our next <a href="http://www.orlandmedia.com/training/flash/applied_as3/">Applied ActionScript 3.0 course</a> will more than likely be scheduled for early July, 2009.</p>
<p>The course is limited to only 5 delegates. If you would like to reserve a place please <a href="http://www.orlandmedia.com/contact/">let us know</a> &#8211; we&#8217;d be happy to have you there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.orlandmedia.com/blog/actionscript-3/as3-course-in-july/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error #1007: Instantiation attempted on a non-constructor with APE</title>
		<link>http://www.orlandmedia.com/blog/actionscript-3/error-1007-instantiation-attempted-on-a-non-constructor-with-ape/</link>
		<comments>http://www.orlandmedia.com/blog/actionscript-3/error-1007-instantiation-attempted-on-a-non-constructor-with-ape/#comments</comments>
		<pubDate>Fri, 01 May 2009 11:40:39 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://www.orlandmedia.com/blog/?p=270</guid>
		<description><![CDATA[We&#8217;re using APE &#8211; the ActionScript Physics Engine &#8211; for our current project.
If you run into the TypeError:
Error #1007: Instantiation attempted on a non-constructor
..when compiling with Flash CS4, the reason is that APE defines a class called Vector, which clashes with a new class, of a different kind, in Flash 10, also called Vector.
The solution [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re using <a href="http://www.cove.org/ape/">APE</a> &#8211; the ActionScript Physics Engine &#8211; for our current project.</p>
<p>If you run into the TypeError:</p>
<p class = "output">Error #1007: Instantiation attempted on a non-constructor</p>
<p>..when compiling with Flash CS4, the reason is that APE defines a class called <code>Vector</code>, which clashes with a new class, of a different kind, in Flash 10, also called <code>Vector</code>.</p>
<p>The solution is to either avoid publishing for Flash 10, if you don&#8217;t need it, or replace all references to Vector throughout the APE code with the fully qualified reference <code>org.cove.ape.Vector</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.orlandmedia.com/blog/actionscript-3/error-1007-instantiation-attempted-on-a-non-constructor-with-ape/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
