Thanks partly to info from people here, I'm getting more comfortable with Actionscript 3, but I've got a problem that is very puzzling.

The program (done entirely in AS3, no Flash) has several different screens. One does music and it's working very well. Another does video. Obviously when somebody goes from music to video we need to make sure the music is turned off. There is a Main screen that handles going from one to the other.

I started out doing it this way, and the reason I got "Call to a possibly undefined method" is obvious. The following is in the Main class, with the "private var" part inside the class but external to the functions and the "music = new MusicPanel" part in one of the functions:

```
private var music:MusicPanel;

music = new MusicPanel(trackNames.songNames, trackNames.numSongs);

```

When switching to the video panel, I added a public function in MusicPanel called StopMusic and called it when the user went to the video panel:

```
if(music != null)
    music.StopMusic();

```

That got the error:

```
Call to a possibly undefined method StopMusic

```

I was checking to make sure music was not null, but that error didn't seem like a bad thing. So I changed the code to:

private var music:MusicPanel = new MusicPanel();

and added a function that would get the song names and number of songs to the music class. That did not help- I got the same error, and in fact the function that tried to put the song names and number of songs got the error also.

At the same time, the Video panel does not give me that error, even though I have laid it out in exactly the same way.

```
private var video:VideoPanel = new VideoPanel;
video.PlayVideo();

```

I do a fair amount of setup on the music screen when it gets called as a new class, I do less setup for the video screen. I'm not sure if that makes a difference.

Clearly there is something I don't understand here. Anybody got any idea what's going on? I've looked at a number of questions about this, but have not found an answer. I think I'm doing this right, but the compiler thinks I'm doing it wrong, so I must be doing it wrong.

**Later Note:** One answer mentioned the difference between Sprite and MovieClip. I gave that a try, changing to MovieClip does not help, and the VideoPanel, which works, extends Sprite.