Copy link to clipboard
Copied
I have a banner that needs a Disclaimer text, triggered by a button.
The Disclaimer text appears on a dark overlay that fades in (a 25 frame movie clip)
Both frame 1 and frame 25 have this.stop(); on the timeline.
First approach:
button on Main Timeline triggers Disclaimer Movieclip to this.gotoAndPlay (2);
Didn't work; can't find how to target the Disclaimer Movieclip (this used to be Tell Target in the old Flash)
Second approach:
button on first frame of Disclaimer Movieclip does this.gotoAndPlay (2);
Back button on last frame of Disclaimer Movieclip does this.gotoAndStop (1);
Doesn’t work; the button on last frame does send the Movieclip back to frame 1, but now the button of frame 1 just doesn’t appear
Third approach:
this.stop(); is moved to frame 2
button on second frame of Disclaimer Movieclip does this.gotoAndPlay (3);
Back button on last frame of Disclaimer Movieclip does this.gotoAndPlay (1);
Strangest thing: when I run this third approach, all goes well: the button on frame 2 plays the Movieclip; dark background fades in / text appears / Back button appears (that sends the Movieclip, when clicked, back to frame 1 – movie plays to frame 2 and stops, huzzah)
And then I click the Disclaimer button again. Everything goes well until we get the disclaimer text and the Back button. When I click that, the banner behaves differently. Movieclip goes back to frame 1 and just plays the whole Movieclip without stopping, through frame 25 where again I have the Disclaimer text and the Back button. So it runs in one way the first time, and in a different way every subsequent run.
What do I do?
Copy link to clipboard
Copied
assign your movieclip an instance name, eg mc. you then use this.mc to reference your movieclip. eg,
this.mc.stop();
this.mc.gotoAndPlay(whatever);
Copy link to clipboard
Copied
Thank you for your attention!
assuming I place a button on the main timeline, with an event listener for the mouse click, and then have a function go:
this.disclaimermovieclip.gotoAndPlay(3);
I think I tried that before, but I will sort that out & try it again
Is there a reason that when testing, my script does what it should first time, but the second time I click the [close] button it goes wonky?
Copy link to clipboard
Copied
yes, but exactly why that is i can't say without more information.