A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: check what button was pressed

  1. #1
    Member
    Join Date
    Jun 2002
    Posts
    30

    check what button was pressed

    Hy everybody!

    I only have one question about variables to all of you:

    OK, I have two buttons and after one of them was pressed, an animation where something happens(still the same,no dificulty if 1 or 2 was pressed), than the movie stops and another movie should load,here it should be checked if button 1 or 2 was pressed and movie 1 or 2 should load.

    PLEASE HELP ME and write me exactly what i have got to do, what scripts and what ever because i'm new to variables.

    The whole problem is in attachement(-;

    Greetings, gmiadlicha
    Attached Files Attached Files

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    In your start script put something to set up your variable like:

    myvar=0;


    then in button 1 up action put

    myvar=1;

    in button 2 up action put

    myvar=2;

    Then later when your first animation is over you jusct check the value of myvar

  3. #3
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    Re: check what button was pressed

    Originally posted by gmiadlicha
    PLEASE HELP ME and write me exactly what i have got to do, what scripts and what ever because i'm new to variables.
    :
    To do that would be a disservice to you.

    Based on your description you could add a scene to the end of the first movie that has one script action that checks the myvar.

    something like
    PHP Code:
    if (myvar==1){
         
    loadMovie("movieone.swf");
     }else{
         
    loadMovie("movietwo.swf");


  4. #4
    Member
    Join Date
    Jun 2002
    Posts
    30

    only one question

    I only have one last question: I must make this now with 4 buttons and 4 movies, OK the scripts with the buttons are the same, but how do i construct such a script(if else) for 4 movies????????

    greetings gmiadlicha

    PS:Wishing you all happy eastern!!!!!!

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    Re: only one question

    Originally posted by gmiadlicha
    I only have one last question: I must make this now with 4 buttons and 4 movies, OK the scripts with the buttons are the same, but how do i construct such a script(if else) for 4 movies????????

    greetings gmiadlicha

    PS:Wishing you all happy eastern!!!!!!
    PHP Code:
    if (myvar==1){
     
    whatever 
      
    }
    elseif (
    myvar==2){
      
    whatever
    }
    elseif (
    myvar==3){
    }
    else {
    whatever

    and so on

    Or you can use Switch Case. See the online help under conditionals.

  6. #6
    Arem
    Join Date
    Oct 2002
    Location
    Inside your computer....
    Posts
    47

    hmmm

    I don't really understand what you mean. If you could clarify it for me i might be able to make it for you.

    Dan

  7. #7
    Member
    Join Date
    Jun 2002
    Posts
    30
    Hy Dan!

    It's real simple:

    1.)I have four buttons
    2.)If you press one of them, then starts an animation(the animation is still the same after all buttons), then a keyframe->stop movie and load movie(1,2,3 or 4)

    3.)So the animation after the buttons are pressed are the same, so i want to reduce filesice->

    Keyframe 1 ->The four buttons->movie stops if you press one button->goto
    Keyframe 2 - the animation
    Keyframe 3 - The movie stops and now the correct movie should load(If buztton one was pressed->movie 1, if button 2 was pressed->movie 2, and so on)

    greetings gmiadlicha

  8. #8
    Member
    Join Date
    Jun 2002
    Posts
    30
    Hy everybody!

    Please help me because i even have not cleared my problem with my check-what-button-pressed scripts and i have real no backround in using scripts!!!!!!!!!!!

    Here is the movie how it finally is.

    greetings gmiadlicha
    Attached Files Attached Files

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