A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Adding Actionscript freezes flash animation

  1. #1
    Member
    Join Date
    Nov 2011
    Posts
    34

    Adding Actionscript freezes flash animation

    Okay, so after posting all the "preloading" .flv / .swf questions, and after getting my answers, I decided to go ahead and write out the scripts in the first few frames to actually preload the .swfs for later...

    I thought I'd start out simple, and I've found that I have no idea what I'm doing.

    I tried to something very basic using actionscript and it freezes up the animation.

    When I use the built-in "go to key frame..." tool, and specify to go to frame 6, and play, the animation works fine.

    When I use the Actionscript interface and actually write out:
    "gotoAndPlay(6);", then the animation get's stuck and only plays the first frame.

    Not sure how I can screw up so quickly. Is there something I'm not understanding about actionscript?
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    Nov 2011
    Posts
    34
    Okay, here's the problem a little more explained:

    No matter what frame number I have in the actionscript, it always goes back to frame 1.

    No matter what.

    I've spent hours trying to get the actionscript to go to a frame other than 1, and nothing's working...

    I've also tried:

    stop();
    gotoAndPlay(6);

    and

    MovieClip(root).gotoAndPlay(6);

    and

    _root.gotoAndPlay(6);

    and probably others.

  3. #3
    Member
    Join Date
    Nov 2011
    Posts
    34
    What??
    Okay, I know I'm not supposed to answer my own question because it looks bad on my part, but I don't want anyone to waste their time:

    I just renamed the frames, and instead of using the number, I used the frame name, and it worked!

    Now, why, I wonder, didn't the numerical way work?

  4. #4
    Super Moderator
    Join Date
    Jun 2000
    Posts
    3,512
    Because 6 in the code corresponds to 6 tween frames. The swf has no concept of key frames unless they are labelled.

  5. #5
    Member
    Join Date
    Nov 2011
    Posts
    34
    Wow, really? Thanks Bob.

    every flash tutorial I have seen that uses "gotoAndPlay()" has had a numeral (like "6") placed within the parentheses, and so far I have not seen any reference to the fact that the frames aren't by default named using their numbers.

    Thanks for the clarification.

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