Skip navigation
alk-288
Currently Being Moderated

Flash Button problem

Mar 25, 2013 7:59 AM

Tags: #buttons #actionscript #flash_cs5 #action_script_2

Okay, so this is my problem, and I can't figure it out.

 

I have a story, and the animation stops to allow the user to make a choice, a or b. However, whenever I click a choice, instead of going to that frame, it starts over.

 

For context, I have added the stop(); actionscript to another layer, the button works fine in the timeline and goes to the desired place, though not in the test preview.

 

It's actionscript 2, and the code for the button is:

 

on (Release){

          gotoAndPlay(320)

}

 

I'm not sure if it's a problem with the scenes, because the buttons [using the same script] worked fine in Scene 1, but now, in Scene 2, it's not working. I've tried to change it to: gotoAndPlay("Scene 2", 320), and still no luck.

 

Any help would be great!

 
Replies
  • Currently Being Moderated
    Mar 25, 2013 8:16 AM   in reply to alk-288

    Use frame labels instead of frame numbers, and if you are in a scene, use the scene name as well.

     

    Better off:

     

    1) don't use scenes at all - they are troublesome things to mix with navigation controls

     

    2) don't place code "on" objects.  Keep the code in the timeline.  Assign instance names to your buttons and use their names to target them...

     

    btn320.onRelease = function (){

         gotoAndPlay("Scene 2", labelname);

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 25, 2013 9:02 AM   in reply to alk-288

    You're welcome

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points