<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Help on Arcanelab Blog</title><link>https://blog.arcanelab.com/tags/help/</link><description>Recent content in Help on Arcanelab Blog</description><generator>Hugo</generator><language>en-US</language><copyright>Zoltán Majoros</copyright><lastBuildDate>Fri, 24 Oct 2008 23:55:00 +0200</lastBuildDate><atom:link href="https://blog.arcanelab.com/tags/help/index.xml" rel="self" type="application/rss+xml"/><item><title>AS3 joy and frustration In the past few weeks I’ve been digging into the realms of the…</title><link>https://blog.arcanelab.com/2008/10/as3-joy-and-frustration-in-the-past-few-weeks-ive-been/</link><pubDate>Fri, 24 Oct 2008 23:55:00 +0200</pubDate><guid>https://blog.arcanelab.com/2008/10/as3-joy-and-frustration-in-the-past-few-weeks-ive-been/</guid><description>&lt;h1&gt;AS3 joy and frustration&lt;/h1&gt;
&lt;p&gt;In the past few weeks I&amp;rsquo;ve been digging into the realms of the Actionscript world as much as I could. (And I was never as excited about any programming language before as I am about AS3.) I&amp;rsquo;ve been reading &lt;b&gt;tons &lt;/b&gt;of documentations (primarily &lt;a target="_blank" href="http://www.adobe.com/go/programmingAS3"&gt;this&lt;/a&gt; one, several times), and still I have black spots even on pretty basic stuff.&lt;/p&gt;
&lt;p&gt;For example, take this code:&lt;/p&gt;
&lt;pre class="sh_cpp"&gt;package &lt;br/&gt;{&lt;br/&gt;	import flash.display.Sprite;&lt;br/&gt;	import flash.events.*;&lt;br/&gt;&lt;br/&gt;	public class Main extends Sprite &lt;br/&gt;	{&lt;br/&gt;&lt;br/&gt;		public function Main():void &lt;br/&gt;		{&lt;br/&gt;			if (stage) init();&lt;br/&gt;			else addEventListener(Event.ADDED_TO_STAGE, init);&lt;br/&gt;		}&lt;br/&gt;&lt;br/&gt;		private function init(e:Event = null):void &lt;br/&gt;		{&lt;br/&gt;			removeEventListener(Event.ADDED_TO_STAGE, init);&lt;br/&gt;			// entry point&lt;br/&gt;&lt;br/&gt;			graphics.beginFill(0x7f7f7f);&lt;br/&gt;			graphics.drawCircle(300, 300, 300);&lt;br/&gt;			graphics.endFill();&lt;br/&gt;&lt;br/&gt;			addEventListener(MouseEvent.MOUSE_MOVE, handler);&lt;br/&gt;		}&lt;br/&gt;&lt;br/&gt;		private function handler(e:MouseEvent):void&lt;br/&gt;		{&lt;br/&gt;			trace(e);&lt;br/&gt;		}		&lt;br/&gt;	}	&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Seems pretty trivial, eh? The problem is that if I attach an event-listener to the main class of the swf file (as I did in the example above), seemingly no &lt;b&gt;MouseEvent&lt;/b&gt; will be dispatched to the handler. If I add the very same event-listener to the &lt;i&gt;stage&lt;/i&gt;, the mouse events suddenly start to be delievered.&lt;/p&gt;</description></item></channel></rss>