A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Button actions

  1. #1
    Junior Member
    Join Date
    Mar 2002
    Posts
    12
    Hi,

    This might sound a bit confusing but it's a simple setup:

    I have 2 graphics that when clicked on go to the same location on the screen. Only 1 can be at that location.
    I converted them to buttons. I set it up so that if graphic 1 is clicked on then the result is displayed on layer 10 and if graphic 2 is clicked on the result is displayed on layer 20.

    My problem is, I have a final button that when clicked needs to show the result of which graphic was clicked on but the problem is that I have both on the timeline. So if I say go to frame 30, and I insert a frame on all layers then I'll get the result of the graphic in the latest frames in this case frame 20.

    Not sure how to get around this. Thanks for your help.

  2. #2
    United States Presidential Hopeful in 2028
    Join Date
    Dec 2000
    Posts
    756
    I'm not sure exactly what you are trying to do, but you'll probably need to use variables. Have the button press set a variable to 1 or 2 depending on the button that was pressed. Then in the end you can evaluate the variable to determine which button was pressed last.

  3. #3
    Junior Member
    Join Date
    Mar 2002
    Posts
    12

    Thanks

    Thanks. I haven't tried it yet but it sounds like it makes sense. I just needed a general direction on what to do.

  4. #4
    Junior Member
    Join Date
    Mar 2002
    Posts
    12

    Button Action

    Hi,

    I seem to be stuck on some code. The final button that evaluates which of the two buttons has been pressed has the following action:

    on (release) {
    if (line1="hop") {
    gotoAndPlay (30);
    } else if (line1="swim") {
    gotoAndPlay (35);
    }
    stop ();
    }

    When I display the value of the variables, they're correct. The above code doesn't work. The button doesn't do anything.

    Also, when I'm setting the variable, I create a variable and give it the following value:
    Line1 = " ";
    Then for each of the buttons that gets selected, I have the action:
    Line1 = "hop"; or
    Line1 = "swim";
    depending on the button.
    Not sure if I'm messing up here.

    Thanks for your help.

    Thanks for your help.

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