Skip to main content
Inspiring
May 7, 2008
Question

Can't tell root or parent to play

  • May 7, 2008
  • 3 replies
  • 900 views
This is very simple - I have a main game interface into which I have loaded a game movieclip.

When the game is done, I have a button (in the game movieclip) that tells the main timeline to play (so we can go onto the next game).

For some reason that is not working for me. I'll attach my code below.

in addition to nextFrame I have tried play, goto statements - everything I can think of.

I don't get any errors, and the trace function works.
This topic has been closed for replies.

3 replies

Participant
May 8, 2008
Instead of having the loaded swf control the main movie, have it dispatch a custom event like GAME_COMPLETE. Then attach a listener for the event to the loaded swf in the main movie. Make sure to set the "bubbles" property of the custom event to "true", so that the main movie recieves it. This way you don't have to worry about communicating with the main movie from the loaded game. Make everything event-based.
Inspiring
May 7, 2008
If the game is in a loader, then you can access the actual loaded movieclip by accessing the loader's content property.
Inspiring
May 7, 2008
I think we're getting somewhere now.

What if I am in the SWF that has been loaded into the loader, and I want to tell the root movie to go to the next frame.

Inspiring
May 8, 2008
This still isn't working for me. Any help would be appreciated. I have used a loader to load an swf. From within that swf I would like to tell the parent movie (root) to go to the next frame.

seems simple - but not working.
Ned Murphy
Legend
May 7, 2008
I am assuming the button is not buried in the child MovieClip...

Try:

(this.parent as MovieClip).nextFrame();
Inspiring
May 7, 2008
Now when I do that, I get this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference. at MethodInfo-40()

It looks like I loaded my game into a Loader rather than a movieClip.

How does this change what I should do?