FLASH help! Is this script possible for ActionScript 2.0?

  • qngotron
  • Born
  • Born
  • qngotron
  • Posts: 2

Post 3+ Months Ago

So, I have a button on frame 60. On release I want it to go to and play frames 16 to 31 and then jump right to frame 61...

Is there such a script for this?

I asked a friend of mine and he told me to make the button on frame 60 go straight to 16, and then make a script on frame 31 to go to frame 61... But this will not work because when the flash plays the first time through, it will jump from frame 31 to 61 and all that's in between will not be seen!

  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23469
  • Loc: Woodbridge VA

Post 3+ Months Ago

Yes it's possible. Set a variable that you can test for the value of in frame 31

In frame 1 add this:

Code: [ Select ]
_global.xx = null;

This creates a global variable "xx" that can be used anywhere in the movie. You're setting the value to null so that initially it has no value.

In frame 31 add this:

Code: [ Select ]
if(xx == 1)
  2. stop();
  3. if(xx == 1)
  4. {
  5. gotoAndPlay(61);
  6. }
  7. else
  8. {
  9. gotoAndPlay(32);
  10. }

This evaluates your global xx variable when you hit frame 31 (I'm typing this on the fly - if this doesn't work initially you may want to add an onEnterFrame event listener). Initially it is null so it will continue to frame 32 and play through frame 60. With the code below on your button we'll change the value of xx to equal 1 so the second pass through it will skip to 61.

In frame 60 for your button action add:
Code: [ Select ]
_global.xx = 1;
on (release){
  1. _global.xx = 1;
  2. on (release){
  3. gotoAndPlay(16);
  4. }

*keep in mind that if later in your movie you want to return back to frame 1 or frame 16 you'll need to adjust the value of xx accordingly. Make sense?

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 3 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.