Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WHY WON'T gotoAndPlay() PLAY?!

Status
Not open for further replies.

wreikun

Technical User
Apr 23, 2002
63
US
Hello all. Ive been working on a flash project (using flash5) and am using some actionscript to which Im experiencing an odd problem. I have a movieclip on the _root level. I will name this movieclip instance "vitamins". this movieclip contains a simple tween. in frame 1, there is a "stop()" command so it will not run until intructed to. now, i want the movieclip instance "vitamins" to begin playing when a separate movie clip whos location is _root.movieclip.this_movieclip reaches the last frame. this last frame contains the actionscript:

_root.vitamins.gotoAndPlay(2);

I would expect the vitamins movieclip to play through its entire tween animation, however, the vitamins movieclip goes to frame 2 and STOPS. Why in the world does it just stop when the command is specifically telling the movieclip to go to frame 2 and play through.

Can anybody offer any help? This is kind of frustrating, cuz Im not able progress any further until this problem gets solved.

Thanks,
REI
 
I have had this problem too, but i can't tell you why Flash does that. The only thing i can tell you is that i worked around it. I didn't put any stop() action in the first frame of the movie, and instead, i stopped it either with

onClipEvent(load){ this.gotoAndStop(1); }

or with some actions in the first frame of the main movie, with something like

_root.vitamins.gotoAndStop(1);

this way it worked when i told the movieclip to go play from another frame, or even 1.
try it and let me know if it works.

Diana.
diana@cyberslotz.co.uk
 
Hello Diana. Thanks for the reply. I tried out your suggestion, and the movieclips are still not playing when told to. They still just jump to the frame number and stop.

According to what you said, I put an action in the first frame of the main area with the following script:

_root.vitamins.gotoAndStop(1);

Then, I tried making the 'vitamins' movieclip play from the following script in a different movieclip:

if(condition is true){
_root.vitamins.gotoAndPlay(2);
}

When I test the movie, the vitamins movieclip stops at frame 2 and doesnt play through till the end of the movieclip.

When I put this script:

onClipEvent(load){ this.gotoAndStop(1); }

in the first frame of the viatmins movieclip, it generated an error message when I tried to test it.

Any other suggestions or help would be greatly appreciated.

Thanks!!
--REI


 
Hello again. After tinkering around a bit, I found that using the following script in the main timeline (frame 1) stops the vitamins movieclip at frame 1:

_root.vitamins.gotoAndStop(1);

I was able to get the movieclip to play through with the following script:

_root.vitamins.gotoAndPlay(2);

-- H O W E V E R --

it only seems to work when the above 'gotoAndPlay' script is in the main timeline ONLY. It wont work when the script is in another movieclip, which is what I would like to have do. This is too weird and it doesnt make sense.

Thanks in advance.

--REI
 
Is your stop action on it's own layer and only on the first keyframe? In other words, do you have a blank keyframe in frame 2, so that the stop action won't be valid throughout the length of your tween? Regards,

new.gif
 
Hello oldnewbie. Yes, the stop action is only applied in the first frame. Just to be sure, I even added an empty keyframe after the keyframe with the 'stop()' action. It still doesnt play through. Is this some kind of bug in flash 5? This is really giving me a headache.

--REI
 
try:

tellTarget ("/vitamins") {
gotoAndPlay(2);
}

This should work for you if they are both on the main timeline! :eek:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top