Copy link to clipboard
Copied
I am trying to do a simple script and I am having a huge brain fart.
when I get to frame 45 I want the play head to go back to frame 1. I have the below code but I am getting errors. Can someone point my head in the right direction?
<><><>
onFrame (45) {
this.gotoAndPlay(1);
}
<><><>
One error says that "is expecting semi-colon before or after first brace.....
second possible error is "call to possible undefined method onFrame....
Need help. ![]()
If that is the first scene, the in the last frame (45) simply putting...
gotoAndPlay(1);
should work.
If it is not the first scene, then you should label the first frame and use the label instead of the frame number...
gotoAndPlay("firstFrameLabel");
Copy link to clipboard
Copied
i have three suggestions that may work, im a noob myself but i think i know the answer to this one,
1st try going to frame one and adding a stop(); on it
if not try making it a gotoAndStop(1) instead of play
if all else fails try something a little harder:
instancenameofyourbutton.addEventListener(MouseEvent.CLICK, BackToStart)
function BackToStart(event:MouseEvent):void
{
MovieClip(this.root).gotoAndPlay(1,"Scene 1");
}
Copy link to clipboard
Copied
I have a pulse action happening on some items on the stage. I am letting the play head go for 45 frames then on the 45th frame I just want the play head to go back to frame 1 thus giving the repeating action of pulse.
The event would be the appearance of frame (45) I guess.
Copy link to clipboard
Copied
If you want the timeline to continuously loop, then you don't need any code - that is a natural behavior. Just be sure not to have a stop() command anywhere in the timeline.
Copy link to clipboard
Copied
I just tested your comment. I have not stop(); actions. This issue with this is that I am using scenes for different portions of the program. I need to have something that directs the play head back to frame 1 so it does not continue into the next scene.
I did this back in the day with Swish Max but now in flash it seems to be difficult to do.
Any ideas of a work around?![]()
Copy link to clipboard
Copied
If that is the first scene, the in the last frame (45) simply putting...
gotoAndPlay(1);
should work.
If it is not the first scene, then you should label the first frame and use the label instead of the frame number...
gotoAndPlay("firstFrameLabel");
Copy link to clipboard
Copied
Great! This works. I will also keep in mind to use frame labels for my other scenes. That would have been my next post in the next couple of hours. ![]()
Thank you much!!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more