A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Question on gotoAndStop()

  1. #1
    Senior Member
    Join Date
    Jan 2002
    Posts
    121

    Question on gotoAndStop()

    Hi guys,

    I'm trying something *very* simple, and I don't understand why it doesn't work as expected.

    • I create 4 empty frames.
    • I put this one single line of AS code on frame 1:
      gotoAndStop(3);
    • On the remaining 3 frames, I just put one text string each that simply identifies the frame (like "This is frame 2").


    Shouldn't the movie just jump to frame #3 and stop? I.e., the only thing you see is the text on frame #3?

    When I play it in the web browser (flash player V6), (Crtl-SpaceBar), the movie first runs to the end, showing all frames, then stops at frame #2.

    When I play it in the stand-alone Flash players V5 and V6 , it only displays frame #2. When I play it in the stand-alone Flash player V4, I only get an empty frame (but shouldn't gotoAndStop work in V4 also?).

    I'm kind of having trouble understanding this behavior

    Anybody out there who can shed some light?

    I'm using the latest 3.60 beta, btw.

    Stephan
    www.aspetersen.de
    Enabling you to communicate across cultures

  2. #2
    Senior Member
    Join Date
    Jun 2000
    Posts
    3,512
    Are tweens set to 0? It is best to name the key frames and use a goto with a frame name.

  3. #3
    Senior Member
    Join Date
    Jan 2002
    Posts
    121
    Hi Bob,

    thanks for your reply.

    Are tweens set to 0? It is best to name the key frames and use a goto with a frame name.
    Only for the first frame did I set tweens to 0, the other frames have tweens set to 6.

    I changed the movie (see attachment) and now labelled the frames ("start", "frame2", "frame3", "frame4"), using gotoAndStop("frame3") on frame "start".

    When I play it in the web browser, the movie now jumps to "frame3", then goes to "frame4" (i.e. runs to the end), then stops at "frame3".

    When I play it in the stand-alone Flash players V5 and V6 , it behaves correctly, i.e. it only displays "frame3".

    When I play it in the stand-alone Flash player V4, I still only get an empty frame.

    Stephan
    www.aspetersen.de
    Enabling you to communicate across cultures

  4. #4
    Senior Member
    Join Date
    Jan 2002
    Posts
    121
    Oops,

    somehow the attachment got lost...

    Stephan
    Attached Files Attached Files
    www.aspetersen.de
    Enabling you to communicate across cultures

  5. #5
    Senior Member
    Join Date
    Jun 2000
    Posts
    3,512
    Swf exports with action script are tagged as flash version 5.

    Using goto commands with frame numbers is dangerous with tweens not equal to zero unless you carefully count the actual frames (key frames + tweens). That is why it is safer to use frame names.

    It is possible that goto commands do not work well on the first frame.
    Last edited by Bob Hartzell; 12-09-2002 at 12:22 PM.

  6. #6
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Its the Frame 0 Flash Player Bug. In the Browser Players Frame 0 (The first Frame) all frame actions are ignored the first time the movie runs. It is documented a documented bug in the Player. Adding a preloader fixes this.

    As far as using numbered Frames for Goto and Stop- Agreed it is much safer to goto a frame as it is easy to miscount frames especially if you decide to later add some tweens or a preloader it will throw it off.

  7. #7
    Senior Member
    Join Date
    Jan 2002
    Posts
    121
    Bob and johnie:

    thanks for your help!

    Stephan
    www.aspetersen.de
    Enabling you to communicate across cultures

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center