A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: variable if statement for gansters game

  1. #1
    Senior Member James Bending's Avatar
    Join Date
    May 2001
    Location
    Devon, England.
    Posts
    157

    Howdy!

    Heres the problem i'll try to explain as cleary as i can.

    I have two frames. On the first frame a dynamic text with the variable name "LETTER" and two buttons. One with this statement
    ---------------------------------------------------

    on (release) {
    LETTER = "A";
    }

    and the other with this statement

    on (release) {
    LETTER = "B";
    }

    --------------------------------------------------

    Frame 2 has this but also a movie with an instance name "GUN". The movie "GUN" has two frames with stop actions each frame has a different image.
    Frame 2 of the main timeline (not the "GUN" movie) has also got this actionscript on it;

    --------------------------------------------------
    gotoAndPlay (1);
    if (LETTER == "B") {
    tellTarget ("GUN") {
    gotoAndPlay (1);
    }
    if (LETTER == "A") {
    tellTarget ("GUN") {
    gotoAndPlay (2);
    }
    }
    } else {
    gotoAndPlay (1);
    }
    --------------------------------------------------
    As you can see the 'desired' effect is to have the buttons change a variable and then a piece of sript finding out what the variable is and changing a movie according to the appropriate letter but it don't work! boohoo!

    If you can help i'd be really really thankful and buy you a cake of your choice!*

    Thanks a bunch for your time
    James Bending


    *this is a lie.



  2. #2
    Junior Member
    Join Date
    Aug 2000
    Posts
    14
    I don't know if this will work, but i think you shoud try this way:

    1. You need two layers each one with three frames:
    Place the "GUN" MC, the text field and the buttons in the first frame of one layer.(Don't place any other keyframe on this layer.)
    2. In the second layer you should have a blank keyframe on the third frame wich contains the following action:
    ----------------------------------
    if (LETTER == "B") {
    tellTarget ("GUN") {
    gotoAndPlay (1);
    }
    }
    if (LETTER == "A") {
    tellTarget ("GUN") {
    gotoAndPlay (2);
    }
    }
    gotoAndPlay (2);
    -----------------------------------
    I did'nt try it.. hope it works.

    Sav

  3. #3
    Senior Member James Bending's Avatar
    Join Date
    May 2001
    Location
    Devon, England.
    Posts
    157
    Originally posted by Swed
    I don't know if this will work, but i think you shoud try this way:

    1. You need two layers each one with three frames:
    Place the "GUN" MC, the text field and the buttons in the first frame of one layer.(Don't place any other keyframe on this layer.)
    2. In the second layer you should have a blank keyframe on the third frame wich contains the following action:
    ----------------------------------
    if (LETTER == "B") {
    tellTarget ("GUN") {
    gotoAndPlay (1);
    }
    }
    if (LETTER == "A") {
    tellTarget ("GUN") {
    gotoAndPlay (2);
    }
    }
    gotoAndPlay (2);
    -----------------------------------
    I did'nt try it.. hope it works.

    Sav

    Cheers sav your a gift to this world, thanks for helping out! (it worked by the way )

    James

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