Skip to main content
Inspiring
July 5, 2007
Answered

use of gotoAndplay in AS 3.0

  • July 5, 2007
  • 2 replies
  • 401 views
Hi,

I am learning and using as 3.0. It is really great.
But now I use some timeline scripts with author-environment created clips.
clipA contains clip B.
Under clip B, in the script layer, I want to tell clip A to go to frame 2 with the following script :
this.parent.gotoAndPlay("intro");

I got an error message telling that gotoAndPlay is not defined.

How can I make such a simple and usual function work?

Thanks
This topic has been closed for replies.
Correct answer ritpas
Thanks sr817!

I didn't manage to do by using both of your soltion :
- inverting this and parent doesn't work and using a frame number doesn't use either.

At last, I centralized my code on the uppest level, so that gotoAndPlay is launched directly in the timeline contaning the concerned frame.

Cheers

2 replies

Participating Frequently
July 5, 2007
hello again ritpas,

This forum response may also be useful. It's a response to a similar post I made a few days ago:

http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=196&threadid=1281655&enterthread=y

Goodluck
ritpasAuthorCorrect answer
Inspiring
July 5, 2007
Thanks sr817!

I didn't manage to do by using both of your soltion :
- inverting this and parent doesn't work and using a frame number doesn't use either.

At last, I centralized my code on the uppest level, so that gotoAndPlay is launched directly in the timeline contaning the concerned frame.

Cheers
Participating Frequently
July 5, 2007
Hi ritpas,

I've been working in a similar way with AS 3.0, with gotoAndPlay(). Unless I'm not mistaken gotoAndPlay() is not looking for the name of the movieclip or object, but instead wants frame-number input.

In addition, I believe your syntax is slightly off. Instead of this.parent.gotoAndPlay(), I believe it is parent.this.gotoAndPlay(). You call the parent object first, then the "sub-object" located in the parent.

So instead of using the script:
this.parent.gotoAndPlay("intro");

try

parent.this.gotoAndPlay(frame_number); // where frame_number represents the frame you would like to play first.

Hope this helps,
Sam