<?xml version="1.0" encoding="UTF-8"?>
<posts type="array">
  <post>
    <body>x/y *is* the registration point.

Is the registration point of the wall in the center, or in the top left? From what you've said it sounds like its at the top left. That would mean that as long as you can get far enough into the wall in one frame so that your x/y is past that corner, you'd be considered below and right of the wall.</body>
    <body-html>&lt;p&gt;x/y &lt;strong&gt;is&lt;/strong&gt; the registration point.&lt;/p&gt;
&lt;p&gt;Is the registration point of the wall in the center, or in the top left? From what you&amp;#8217;ve said it sounds like its at the top left. That would mean that as long as you can get far enough into the wall in one frame so that your x/y is past that corner, you&amp;#8217;d be considered below and right of the wall.&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-21T05:23:59-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1481603</id>
    <post-number type="integer">4</post-number>
    <topic-id type="integer">65700</topic-id>
    <updated-at type="datetime">2009-11-21T05:23:59-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>bq. gotoAndPlay(&quot;intro&quot;, &quot;Poe&quot;);

If you're specifying a frame label, you don't need to specify a scene as well. It'll find the label regardless of which scene its in.</body>
    <body-html>&lt;blockquote&gt;
&lt;p&gt;gotoAndPlay(&amp;#8220;intro&amp;#8221;, &amp;#8220;Poe&amp;#8221;);&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If you&amp;#8217;re specifying a frame label, you don&amp;#8217;t need to specify a scene as well. It&amp;#8217;ll find the label regardless of which scene its in.&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-20T14:27:20-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1479974</id>
    <post-number type="integer">6</post-number>
    <topic-id type="integer">65553</topic-id>
    <updated-at type="datetime">2009-11-20T14:27:20-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>Sweet. Glad to help.</body>
    <body-html>&lt;p&gt;Sweet. Glad to help.&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-19T01:22:08-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1476124</id>
    <post-number type="integer">8</post-number>
    <topic-id type="integer">65450</topic-id>
    <updated-at type="datetime">2009-11-19T01:22:08-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>I guess that function is the listener for an ENTER_FRAME event?
The next time it gets called, currentFrame will still be 24 and it will try to remove itself again.

It would be best to remove the event listener inside your if block so the function only gets called once.
I also like to safeguard removeChild calls by checking if it has a parent first:

&lt;pre&gt;
if (parent) parent.removeChild(this);
&lt;/pre&gt;</body>
    <body-html>&lt;p&gt;I guess that function is the listener for an ENTER_FRAME event?&lt;br /&gt;
The next time it gets called, currentFrame will still be 24 and it will try to remove itself again.&lt;/p&gt;
&lt;p&gt;It would be best to remove the event listener inside your if block so the function only gets called once.&lt;br /&gt;
I also like to safeguard removeChild calls by checking if it has a parent first:&lt;/p&gt;
&lt;pre&gt;
if (parent) parent.removeChild(this);
&lt;/pre&gt;</body-html>
    <created-at type="datetime">2009-11-19T01:20:53-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1476122</id>
    <post-number type="integer">3</post-number>
    <topic-id type="integer">65453</topic-id>
    <updated-at type="datetime">2009-11-19T01:20:53-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>It must be the stage references. That's the only thing there that could be null.

It kinda makes sense since stage is null until the object is added to the stage, although when I test your code it runs fine which suggests the frame 1 stuff isn't run instantly.

So I'd try it with the stage lines commented out. If that fixes the problem you can just set it up to wait for an ADDED_TO_STAGE event before setting up those mouse listeners

&lt;pre&gt;
this.addEventListener(Event.ADDED_TO_STAGE, addedToStage);
function addedToStage(event:Event) {
    stage.addEventListener(MouseEvent.MOUSE_DOWN, down);
    stage.addEventListener(MouseEvent.MOUSE_UP, up);
}
&lt;/pre&gt;</body>
    <body-html>&lt;p&gt;It must be the stage references. That&amp;#8217;s the only thing there that could be null.&lt;/p&gt;
&lt;p&gt;It kinda makes sense since stage is null until the object is added to the stage, although when I test your code it runs fine which suggests the frame 1 stuff isn&amp;#8217;t run instantly.&lt;/p&gt;
&lt;p&gt;So I&amp;#8217;d try it with the stage lines commented out. If that fixes the problem you can just set it up to wait for an ADDED_TO_STAGE event before setting up those mouse listeners&lt;/p&gt;
&lt;pre&gt;
this.addEventListener(Event.ADDED_TO_STAGE, addedToStage);
function addedToStage(event:Event) {
    stage.addEventListener(MouseEvent.MOUSE_DOWN, down);
    stage.addEventListener(MouseEvent.MOUSE_UP, up);
}
&lt;/pre&gt;</body-html>
    <created-at type="datetime">2009-11-19T00:07:07-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1476099</id>
    <post-number type="integer">6</post-number>
    <topic-id type="integer">65450</topic-id>
    <updated-at type="datetime">2009-11-19T00:07:19-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>That's where the error is then. If you're still having trouble could you post that code?</body>
    <body-html>&lt;p&gt;That&amp;#8217;s where the error is then. If you&amp;#8217;re still having trouble could you post that code?&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-18T23:43:48-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1476082</id>
    <post-number type="integer">4</post-number>
    <topic-id type="integer">65450</topic-id>
    <updated-at type="datetime">2009-11-18T23:43:48-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>Seems like the error is inside the constructor for LoadingDot. Or frame 1 of Loading dot.. do you have code on its timeline?</body>
    <body-html>&lt;p&gt;Seems like the error is inside the constructor for LoadingDot. Or frame 1 of Loading dot.. do you have code on its timeline?&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-18T23:15:31-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1476054</id>
    <post-number type="integer">2</post-number>
    <topic-id type="integer">65450</topic-id>
    <updated-at type="datetime">2009-11-18T23:15:31-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>You can't load them to specific frames unfortunately.

You would have to cycle through an array. Looks like it's actually pretty messy to do this in as2 since there doesn't seem to be a way of accessing loaded images as BitmapData. You'd have to load them into MovieClips and then draw the current one onto a bitmapData onscreen or something I guess.</body>
    <body-html>&lt;p&gt;You can&amp;#8217;t load them to specific frames unfortunately.&lt;/p&gt;
&lt;p&gt;You would have to cycle through an array. Looks like it&amp;#8217;s actually pretty messy to do this in as2 since there doesn&amp;#8217;t seem to be a way of accessing loaded images as BitmapData. You&amp;#8217;d have to load them into MovieClips and then draw the current one onto a bitmapData onscreen or something I guess.&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-18T13:47:18-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1474561</id>
    <post-number type="integer">2</post-number>
    <topic-id type="integer">65335</topic-id>
    <updated-at type="datetime">2009-11-18T13:47:18-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>bq. Drat, I think I&#8217;ve mucked things up. gotoAndStop takes me to a frame (right?), when I&#8217;ve actually put the game in a different scene, and not a different frame.

You can use &lt;code&gt;gotoAndStop(&quot;Scene 2&quot;, 1);&lt;/code&gt; to go to frame 1 of scene 2. Although gotoAndStop(2) would probably work anyway if Scene 1 is only 1 frame, since all the scenes are essentially just one big timeline.
Its a good idea to use framelabels for stuff like this. Then you can use gotoAndStop(&quot;frame label&quot;) and it'll work regardless of what scene its in.


bq. but the load bar never advances.

In as2, &lt;code&gt;_xscale&lt;/code&gt; is a percentage. It goes up to 100 rather than being a decimal, so your code will only ever fill it to 1% at most.</body>
    <body-html>&lt;blockquote&gt;
&lt;p&gt;Drat, I think I&#8217;ve mucked things up. gotoAndStop takes me to a frame (right?), when I&#8217;ve actually put the game in a different scene, and not a different frame.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You can use &lt;code&gt;gotoAndStop(&quot;Scene 2&quot;, 1);&lt;/code&gt; to go to frame 1 of scene 2. Although gotoAndStop(2) would probably work anyway if Scene 1 is only 1 frame, since all the scenes are essentially just one big timeline.&lt;br /&gt;
Its a good idea to use framelabels for stuff like this. Then you can use gotoAndStop(&amp;#8220;frame label&amp;#8221;) and it&amp;#8217;ll work regardless of what scene its in.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;but the load bar never advances.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In as2, &lt;code&gt;_xscale&lt;/code&gt; is a percentage. It goes up to 100 rather than being a decimal, so your code will only ever fill it to 1% at most.&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-17T08:24:00-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1470768</id>
    <post-number type="integer">7</post-number>
    <topic-id type="integer">65208</topic-id>
    <updated-at type="datetime">2009-11-17T08:24:00-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>The concatenation in 

bq. this.dMetre.text = Math.round(v.x/20) + &quot;&quot;;

happens before the assignment, though. It's still just assigning one string to the TextField, so there's no efficiency loss and the compiler shouldn't be complaining about it.

Are you sure that &lt;code&gt;+=&lt;/code&gt; isn't being used with a TextField somewhere else?</body>
    <body-html>&lt;p&gt;The concatenation in&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;this.dMetre.text = Math.round(v.x/20) + &amp;quot;&amp;quot;;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;happens before the assignment, though. It&amp;#8217;s still just assigning one string to the TextField, so there&amp;#8217;s no efficiency loss and the compiler shouldn&amp;#8217;t be complaining about it.&lt;/p&gt;
&lt;p&gt;Are you sure that &lt;code&gt;+=&lt;/code&gt; isn&amp;#8217;t being used with a TextField somewhere else?&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-17T08:15:15-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1470755</id>
    <post-number type="integer">3</post-number>
    <topic-id type="integer">65213</topic-id>
    <updated-at type="datetime">2009-11-17T08:15:38-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>True, but they would be better off implementing a proper pause function which can go through the same hierarchy. That's a one time cost when the game first gets paused instead of having every MovieClip polling some global variable individually every frame.</body>
    <body-html>&lt;p&gt;True, but they would be better off implementing a proper pause function which can go through the same hierarchy. That&amp;#8217;s a one time cost when the game first gets paused instead of having every MovieClip polling some global variable individually every frame.&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-17T08:04:49-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1470748</id>
    <post-number type="integer">11</post-number>
    <topic-id type="integer">65063</topic-id>
    <updated-at type="datetime">2009-11-17T08:04:49-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>bq. It&#8217;s global because every class needs to have unfettered access to it.

it depends on the design of your game. Some would say that the game is badly designed if more than one class needs to have access to it.

Like Vexthil was saying, there should really be one main class which has a central 'update' function (the game loop). It tells things when to update, and they in turn tell other things to update, down in a heirarchy.
If gameIsPaused was an instance variable in that main class, it could just stop telling everything to update while it is set to true.</body>
    <body-html>&lt;blockquote&gt;
&lt;p&gt;It&#8217;s global because every class needs to have unfettered access to it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;it depends on the design of your game. Some would say that the game is badly designed if more than one class needs to have access to it.&lt;/p&gt;
&lt;p&gt;Like Vexthil was saying, there should really be one main class which has a central &amp;#8216;update&amp;#8217; function (the game loop). It tells things when to update, and they in turn tell other things to update, down in a heirarchy.&lt;br /&gt;
If gameIsPaused was an instance variable in that main class, it could just stop telling everything to update while it is set to true.&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-17T07:29:13-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1470727</id>
    <post-number type="integer">9</post-number>
    <topic-id type="integer">65063</topic-id>
    <updated-at type="datetime">2009-11-17T07:29:13-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>and since this class is controlling your preloader, &lt;code&gt;this.gotoAndStop(2);&lt;/code&gt; will make your preloader go to frame 2, not your main timeline.

One way to solve that would be changing it to &lt;code&gt;_root.gotoAndStop(2);&lt;/code&gt;</body>
    <body-html>&lt;p&gt;and since this class is controlling your preloader, &lt;code&gt;this.gotoAndStop(2);&lt;/code&gt; will make your preloader go to frame 2, not your main timeline.&lt;/p&gt;
&lt;p&gt;One way to solve that would be changing it to &lt;code&gt;_root.gotoAndStop(2);&lt;/code&gt;&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-17T07:24:01-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1470720</id>
    <post-number type="integer">5</post-number>
    <topic-id type="integer">65208</topic-id>
    <updated-at type="datetime">2009-11-17T07:24:01-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>KEY_DOWN is dispatched when you push any key down, not just the 'down' key. Individual keys don't dispatch different events - they all dispatch KEY_DOWN and then you check the &lt;code&gt;keyCode&lt;/code&gt; property of the event to see which key it was.

onKeypress and onKeyRelease are already dealing with 'p' keypresses (keyCode 80 is p), so you can dispatch your event from there.

Also, you need to attach your listener inside a function somewhere - not just loose in the class. The constructor would be a good place to do that for most events, but since you need to add the listener to the stage you should wait for an Event.ADDED_TO_STAGE event and then attach yourlistener to the stage.

Assuming 'Game' is the name of your game class

&lt;pre&gt;
import flash.ui.Keyboard;
import flash.events.KeyboardEvent;

public var pauseKeyIsBeingPressed:Boolean = false;

public function Game()
{
	addEventListener(Event.ADDED_TO_STAGE, onAddedToStage, false, 0, true);
}

public function onAddedToStage(event:Event):void
{
	stage.addEventListener( KeyboardEvent.KEY_DOWN, onKeyPress, false, 0, true );
	stage.addEventListener( KeyboardEvent.KEY_UP, onKeyRelease, false, 0, true );
}

public function onKeyPress( keyboardEvent:KeyboardEvent ):void
{
	if ( keyboardEvent.keyCode == 80 )
	{
		if (!pauseKeyIsBeingPressed)
		{
			dispatchEvent( new NavigationEvent( NavigationEvent.SUBMENU ) );
		}

		pauseKeyIsBeingPressed = true;
	}
}

public function onKeyRelease( keyboardEvent:KeyboardEvent ):void
{
	if ( keyboardEvent.keyCode == 80 )
	{
		pauseKeyIsBeingPressed = false;
	}
}
&lt;/pre&gt;</body>
    <body-html>&lt;p&gt;KEY_DOWN is dispatched when you push any key down, not just the &amp;#8216;down&amp;#8217; key. Individual keys don&amp;#8217;t dispatch different events &amp;#8211; they all dispatch KEY_DOWN and then you check the &lt;code&gt;keyCode&lt;/code&gt; property of the event to see which key it was.&lt;/p&gt;
&lt;p&gt;onKeypress and onKeyRelease are already dealing with &amp;#8216;p&amp;#8217; keypresses (keyCode 80 is p), so you can dispatch your event from there.&lt;/p&gt;
&lt;p&gt;Also, you need to attach your listener inside a function somewhere &amp;#8211; not just loose in the class. The constructor would be a good place to do that for most events, but since you need to add the listener to the stage you should wait for an Event.ADDED_TO_STAGE event and then attach yourlistener to the stage.&lt;/p&gt;
&lt;p&gt;Assuming &amp;#8216;Game&amp;#8217; is the name of your game class&lt;/p&gt;
&lt;pre&gt;
import flash.ui.Keyboard;
import flash.events.KeyboardEvent;

public var pauseKeyIsBeingPressed:Boolean = false;

public function Game()
{
	addEventListener(Event.ADDED_TO_STAGE, onAddedToStage, false, 0, true);
}

public function onAddedToStage(event:Event):void
{
	stage.addEventListener( KeyboardEvent.KEY_DOWN, onKeyPress, false, 0, true );
	stage.addEventListener( KeyboardEvent.KEY_UP, onKeyRelease, false, 0, true );
}

public function onKeyPress( keyboardEvent:KeyboardEvent ):void
{
	if ( keyboardEvent.keyCode == 80 )
	{
		if (!pauseKeyIsBeingPressed)
		{
			dispatchEvent( new NavigationEvent( NavigationEvent.SUBMENU ) );
		}

		pauseKeyIsBeingPressed = true;
	}
}

public function onKeyRelease( keyboardEvent:KeyboardEvent ):void
{
	if ( keyboardEvent.keyCode == 80 )
	{
		pauseKeyIsBeingPressed = false;
	}
}
&lt;/pre&gt;</body-html>
    <created-at type="datetime">2009-11-17T07:21:34-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1470715</id>
    <post-number type="integer">3</post-number>
    <topic-id type="integer">65215</topic-id>
    <updated-at type="datetime">2009-11-17T07:21:47-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>I can't think of a good solution. The best I can come up with is to not exactly use them like buttons. Instead, when you click, hitTest each of the 'buttons' against the mouse position. If any hit, check the pixel of the BitmapData that the mouse is hovering over to see if it has any alpha. If more than one button passes the test, use the one with the higher depth.</body>
    <body-html>&lt;p&gt;I can&amp;#8217;t think of a good solution. The best I can come up with is to not exactly use them like buttons. Instead, when you click, hitTest each of the &amp;#8216;buttons&amp;#8217; against the mouse position. If any hit, check the pixel of the BitmapData that the mouse is hovering over to see if it has any alpha. If more than one button passes the test, use the one with the higher depth.&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-16T10:30:33-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1467935</id>
    <post-number type="integer">3</post-number>
    <topic-id type="integer">64567</topic-id>
    <updated-at type="datetime">2009-11-16T10:30:33-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>Ok,

Create the array:

&lt;pre&gt;
var wallArray:Array = new Array();
&lt;/pre&gt;

Loop through each depth index

&lt;pre&gt;
for (var i:int = numChildren - 1; i &gt;= 0; i--) {
&lt;/pre&gt;

Get a reference to whatever occupies that depth index

&lt;pre&gt;
var child:DisplayObject = getChildAt(i);
&lt;/pre&gt;

Check if its instance name is &quot;wall&quot;. If it is, add it to the array

&lt;pre&gt;
if (child.name == &quot;wall&quot;) {
	wallArray.push(child);
}
&lt;/pre&gt;



I'm not sure what your collision detection code is like, but you'll have to loop through wallArray to check each wall

&lt;pre&gt;
for each(var wall:Sprite in wallArray) {
	if (player.hitTestObject(wall)) { // or whatever your collision detection is
		// react to the collision
	}
}
&lt;/pre&gt;</body>
    <body-html>&lt;p&gt;Ok,&lt;/p&gt;
&lt;p&gt;Create the array:&lt;/p&gt;
&lt;pre&gt;
var wallArray:Array = new Array();
&lt;/pre&gt;
&lt;p&gt;Loop through each depth index&lt;/p&gt;
&lt;pre&gt;
for (var i:int = numChildren - 1; i &amp;gt;= 0; i--) {
&lt;/pre&gt;
&lt;p&gt;Get a reference to whatever occupies that depth index&lt;/p&gt;
&lt;pre&gt;
var child:DisplayObject = getChildAt(i);
&lt;/pre&gt;
&lt;p&gt;Check if its instance name is &amp;#8220;wall&amp;#8221;. If it is, add it to the array&lt;/p&gt;
&lt;pre&gt;
if (child.name == &quot;wall&quot;) {
	wallArray.push(child);
}
&lt;/pre&gt;
&lt;p&gt;I&amp;#8217;m not sure what your collision detection code is like, but you&amp;#8217;ll have to loop through wallArray to check each wall&lt;/p&gt;
&lt;pre&gt;
for each(var wall:Sprite in wallArray) {
	if (player.hitTestObject(wall)) { // or whatever your collision detection is
		// react to the collision
	}
}
&lt;/pre&gt;</body-html>
    <created-at type="datetime">2009-11-16T05:51:07-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1467635</id>
    <post-number type="integer">4</post-number>
    <topic-id type="integer">65080</topic-id>
    <updated-at type="datetime">2009-11-16T05:51:07-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>You can loop through all children and check their &lt;code&gt;name&lt;/code&gt; property.

&lt;pre&gt;
var wallArray:Array = new Array();
for (var i:int = numChildren - 1; i &gt;= 0; i--) {
	var child:DisplayObject = getChildAt(i);
	if (child.name == &quot;wall&quot;) {
		wallArray.push(child);
	}
}
&lt;/pre&gt;</body>
    <body-html>&lt;p&gt;You can loop through all children and check their &lt;code&gt;name&lt;/code&gt; property.&lt;/p&gt;
&lt;pre&gt;
var wallArray:Array = new Array();
for (var i:int = numChildren - 1; i &amp;gt;= 0; i--) {
	var child:DisplayObject = getChildAt(i);
	if (child.name == &quot;wall&quot;) {
		wallArray.push(child);
	}
}
&lt;/pre&gt;</body-html>
    <created-at type="datetime">2009-11-16T05:16:38-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1467619</id>
    <post-number type="integer">2</post-number>
    <topic-id type="integer">65080</topic-id>
    <updated-at type="datetime">2009-11-16T05:16:38-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>It sounded fine for me, but I noticed there's no preloader. It could be that the game is starting to run before the sounds are fully downloaded. Try adding a preloader and see if it helps.</body>
    <body-html>&lt;p&gt;It sounded fine for me, but I noticed there&amp;#8217;s no preloader. It could be that the game is starting to run before the sounds are fully downloaded. Try adding a preloader and see if it helps.&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-15T18:40:52-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1466688</id>
    <post-number type="integer">2</post-number>
    <topic-id type="integer">65040</topic-id>
    <updated-at type="datetime">2009-11-15T18:40:52-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>Using the IDE, all you need to do is select the TextField, hit 'Embed' in the properties inspector, and select which characters you'll need.</body>
    <body-html>&lt;p&gt;Using the &lt;span class=&quot;caps&quot;&gt;IDE&lt;/span&gt;, all you need to do is select the TextField, hit &amp;#8216;Embed&amp;#8217; in the properties inspector, and select which characters you&amp;#8217;ll need.&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-15T15:52:11-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1466098</id>
    <post-number type="integer">2</post-number>
    <topic-id type="integer">64972</topic-id>
    <updated-at type="datetime">2009-11-15T15:52:11-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>You can use MouseEvent.MOUSE_OUT</body>
    <body-html>&lt;p&gt;You can use MouseEvent.MOUSE_OUT&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-14T16:48:50-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1461240</id>
    <post-number type="integer">2</post-number>
    <topic-id type="integer">64814</topic-id>
    <updated-at type="datetime">2009-11-14T16:48:50-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>e.target will give you whatever child MovieClip you clicked on. e.currentTarget will work better, it gives you whatever dispatched the event.</body>
    <body-html>&lt;p&gt;e.target will give you whatever child MovieClip you clicked on. e.currentTarget will work better, it gives you whatever dispatched the event.&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-14T15:55:29-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1460987</id>
    <post-number type="integer">2</post-number>
    <topic-id type="integer">64802</topic-id>
    <updated-at type="datetime">2009-11-14T15:55:29-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>It's probably not such a big issue for trees since you are ideally only checking a fraction of the total. If your tree can end up horribly balanced then I geuss it's a problem.

Loop is definitely the way to go for LL though.</body>
    <body-html>&lt;p&gt;It&amp;#8217;s probably not such a big issue for trees since you are ideally only checking a fraction of the total. If your tree can end up horribly balanced then I geuss it&amp;#8217;s a problem.&lt;/p&gt;
&lt;p&gt;Loop is definitely the way to go for LL though.&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-13T20:17:35-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1458204</id>
    <post-number type="integer">4</post-number>
    <topic-id type="integer">64671</topic-id>
    <updated-at type="datetime">2009-11-13T20:17:35-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>The original problem is &lt;code&gt;_root&lt;/code&gt; is null.

At the top when you put 

bq. private var _root:MovieClip=MovieClip(root);


the splasher hasn't been added to the stage yet, so its reference to &lt;code&gt;root&lt;/code&gt; is null. root only holds a value when your instance is attached to the stage somehow.

If you really want to have a &lt;code&gt;_root&lt;/code&gt; variable like that, you should listen for &lt;code&gt;Event.ADDED_TO_STAGE&lt;/code&gt; and assign it then.</body>
    <body-html>&lt;p&gt;The original problem is &lt;code&gt;_root&lt;/code&gt; is null.&lt;/p&gt;
&lt;p&gt;At the top when you put&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;private var _root:MovieClip=MovieClip(root);&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;the splasher hasn&amp;#8217;t been added to the stage yet, so its reference to &lt;code&gt;root&lt;/code&gt; is null. root only holds a value when your instance is attached to the stage somehow.&lt;/p&gt;
&lt;p&gt;If you really want to have a &lt;code&gt;_root&lt;/code&gt; variable like that, you should listen for &lt;code&gt;Event.ADDED_TO_STAGE&lt;/code&gt; and assign it then.&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-13T19:09:23-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1457884</id>
    <post-number type="integer">7</post-number>
    <topic-id type="integer">64668</topic-id>
    <updated-at type="datetime">2009-11-13T19:09:23-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>bq. Anytime a variable gets nulled it looses all of its methods?

Right. The variable is pointing to nothing, and nothing doesn't have any methods.


You probably won't see a huge different in speed between recursion and a for loop, but I'd strongly recommend the loop to avoid hitting Flash's cap of 256 levels of recursion.</body>
    <body-html>&lt;blockquote&gt;
&lt;p&gt;Anytime a variable gets nulled it looses all of its methods?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Right. The variable is pointing to nothing, and nothing doesn&amp;#8217;t have any methods.&lt;/p&gt;
&lt;p&gt;You probably won&amp;#8217;t see a huge different in speed between recursion and a for loop, but I&amp;#8217;d strongly recommend the loop to avoid hitting Flash&amp;#8217;s cap of 256 levels of recursion.&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-13T19:02:32-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1457837</id>
    <post-number type="integer">2</post-number>
    <topic-id type="integer">64671</topic-id>
    <updated-at type="datetime">2009-11-13T19:02:32-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
  <post>
    <body>Code on the timeline may get called before &lt;code&gt;onLoad&lt;/code&gt;, so it's probably better to use a constructor for initialization

&lt;pre&gt;
	function BlinkThing() {
		timesLeft = 0;
		_visible = false;
	}
&lt;/pre&gt;

But the main problem is that when you use setInterval, it kinda forgets what class that function is attached to. When doBlink gets called as a result of the interval, it doesn't have access to the variables etc of the class. It's pretty stupid, but it's a quirk of as2.

To get around it, you can use &lt;code&gt;Delegate.create&lt;/code&gt;. That makes it so the function gets called in the scope that you specify (this) and it will have access to the appropriate variables.

&lt;pre&gt;
	function blink(times) {
		if ( timesLeft &lt;= 0 ) {
			timesLeft = 5;
			interval = setInterval(Delegate.create(this, doBlink), 100);
		}
	}
&lt;/pre&gt;


You'll also need to import Delegate at the top of your class

&lt;pre&gt;
import mx.utils.Delegate;
&lt;/pre&gt;


If you don't like the Delegate stuff, you could just count frames in onEnterFrame instead of using intervals.</body>
    <body-html>&lt;p&gt;Code on the timeline may get called before &lt;code&gt;onLoad&lt;/code&gt;, so it&amp;#8217;s probably better to use a constructor for initialization&lt;/p&gt;
&lt;pre&gt;
	function BlinkThing() {
		timesLeft = 0;
		_visible = false;
	}
&lt;/pre&gt;
&lt;p&gt;But the main problem is that when you use setInterval, it kinda forgets what class that function is attached to. When doBlink gets called as a result of the interval, it doesn&amp;#8217;t have access to the variables etc of the class. It&amp;#8217;s pretty stupid, but it&amp;#8217;s a quirk of as2.&lt;/p&gt;
&lt;p&gt;To get around it, you can use &lt;code&gt;Delegate.create&lt;/code&gt;. That makes it so the function gets called in the scope that you specify (this) and it will have access to the appropriate variables.&lt;/p&gt;
&lt;pre&gt;
	function blink(times) {
		if ( timesLeft &amp;lt;= 0 ) {
			timesLeft = 5;
			interval = setInterval(Delegate.create(this, doBlink), 100);
		}
	}
&lt;/pre&gt;
&lt;p&gt;You&amp;#8217;ll also need to import Delegate at the top of your class&lt;/p&gt;
&lt;pre&gt;
import mx.utils.Delegate;
&lt;/pre&gt;
&lt;p&gt;If you don&amp;#8217;t like the Delegate stuff, you could just count frames in onEnterFrame instead of using intervals.&lt;/p&gt;</body-html>
    <created-at type="datetime">2009-11-12T17:28:09-08:00</created-at>
    <flaggings-count type="integer">0</flaggings-count>
    <forced-visibility-state type="boolean">true</forced-visibility-state>
    <forum-id type="integer">4</forum-id>
    <hidden-by-id type="integer" nil="true"></hidden-by-id>
    <id type="integer">1455005</id>
    <post-number type="integer">3</post-number>
    <topic-id type="integer">64476</topic-id>
    <updated-at type="datetime">2009-11-12T17:28:09-08:00</updated-at>
    <user-id type="integer">57306</user-id>
  </post>
</posts>
