You're adding an ADDED_TO_STAGE and an ENTER_FRAME event one after another. The ENTER_FRAME event is checking fBall.stage. At that point you probably have not even added fBall to the stage yet. You should check to see if it exists in your onEnterFrame() method.

Line 56 when I copy your code is exactly what I posted, "if (fBall.stage){". You're checking a property (stage) of something that has not been added to the display list and therefore has no stage property. Please try adding the code I bolded (the easy way) or only add an ENTER_FRAME handler once it has been added to the display list (the better way to reduce wasted cycles).

I'm assuming you have a class that is loading this "HERO" class inside itself because you're trying to access MovieClip(parent). I see you're adding fBall to the parent when the user presses the "W" key. I presumed the parent would have a defined object you're accessing via MovieClip(fBall) when I should have just read all of the code.

You have a direct reference to fBall inside this class that fires off onEnterFrame. You can't reference it via MovieClip(parent).fBall as if it's a direct object reference because it's not. And if you were to try to access it as a MovieClip then you'd need to use a getChild* function of MovieClip(parent) to gain access to it via index or name. But you don't need to do that.

Your first class had it correct. Just access fBall directly like this:

In the future you only need to paste the relevant lines of code giving you an error, plus a few lines above and below it. If you need to paste a large amount of code it's advisable to use something that makes code easy to see like:

You have to remove any MovieClip(parent).fBall references overall. Use fBall directly as I've shown you above. I'll show you how your W key code would look rewritten with it:

if (event.keyCode == Keyboard.W)

{

SOUNDCHANNEL = FIREBALLSOUND.play()

fBall.name = "fb" + String(i);

fBall.width = 20;

fBall.x = 400

fBall.y = 400

fireballindex.push(fBall);

MovieClip(parent).addChild(fBall);

SOUNDCHANNEL = FIREBALLSOUND.play()

i++;

trace(i)

trace(fBall.name)

}

Remove the MovieClip(parent) off of any references to fBall in all your code. That class can directly access fBall. Even though you're adding it to the parent display list you still access it in the class directly using fBall. The class still owns the object.

The HERO class extends MovieClip so you don't need to add it to the parent at all. I'm assuming you have a reason for doing so. Adding it to the HERO display list would make it show up as long as HERO was on the parents display list. Although the position of the object would be relative to the position of the HERO.

When you add the fBall you still want to add it to the parent. While removing MovieClip(parent) from fBall, you didn't remove the MovieClip(parent) when you were adding it to the parents display list did you? Like in the code I posted above I'm still adding the fBall to the parent via:

MovieClip(parent).addChild(fBall);

So if you did a global find/replace and removed MovieClip(parent) then it might look like:

addChild(fBall);

If your HERO class isn't on the display list then you won't see the fireball anymore so make sure you still have MovieClip(parent) on that line.