Monday, March 29, 2010

goToandStop doesn't work

in the onClipEvent script of one of my MC's, ''player'' I tell
that MC to gotoandstop. But it doesn't work. What am I doing wrong?

_root.player.gotoandstop(1);

I've also tried

this.gotoandstop(1);goToandStop doesn't work
try typing it with the correct case:



this.gotoAndStop(1)



Watch for colour change in the actionscript window as the
method is recognised by the editor.

Also, as a general comment, its better to learn to avoid the
onClipEvent style of scripting. Its an older approach that might
seem easier in the short term but won't help long term. I haven't
got CS3 yet, but I'm not sure if its even possible to do that if
you author for flash player 9.goToandStop doesn't work
Hi



Is the clip on frame 1 already? If that the case, I
don麓t think you can gotoAndStop to the same frame.



//Olof
Thanks so much for your help.

I wasn't aware that commands were case sensitive. But I did
change all of my commands to the proper case. And it still didn't
work

_root.player.gotoAndStop(1);

I also tried

this.gotoAndStop(1);



I don't notice a color change in the text of my script. But
maybe that's my version of Flash or something? I'm using Flash MX
on a mac 10.3.9



No, I'm not starting on the same frame that I'm trying to go
to.



GWD, regarding your advice about not using onClipEvent --
okay, well, what do you suggest that I use instead?



BTW, if you'd like to check out my fla, it's available here:
http://theultimateeverything.com/game9.fla



Thanks again for all your help!!


My suggestion was just that... it's not the solution for your
problem, sorry. I guess its still a matter of personal preference
until/unless you decide to go to Flash CS3.



A quick google gave me David Stiller's guide to this if you
want to read more, including the 'new' way of doing things.




http://www.quip.net/blog/2006/flash/museum-pieces-on-and-onclipevent




Okay... But what about my original question?

Thank you.
copy and paste your code.
if your gotoAndStop() doesnt call correctly the best way to
fix that is to use labeled keyframes... instead of using the frame
number, label the frame(s) and then use the gotoAndStop()
function... i guess this would be unrealistic if you are trying to
do that to hundreds of frames but for something less i think this
is a good way to solve that... that is how i move my movieclips
around the timeline for everything in my flash files.
also, i was looking at your game and.... if there is only one
frame and you are trying to use the gotoAndStop() it WONT work...
instead add a second frame call it nothing add the code prevFrame()
to it and on the other frame change the gotoAndPlay() code to
play().... so it will go to the next frame then be sent back to the
previous one.

No comments:

Post a Comment