Actionscript 2.0: Variables and Buttons Question

Discussion in 'Web Design and Development' started by creator2456, Oct 23, 2009.

  1. creator2456 macrumors 68000

    creator2456

    Joined:
    Jul 10, 2007
    Location:
    Chicago
    #1
    If Mods want to move this to Web Design & Development, go right ahead. May be out of place here, but that is what I get for posting while going on 24 hours awake.

    Not sure if this will make since just seeing code, but I am stumped.

    Right now Button B is hittable even if Button A has not been hit.
    I want Button B to ONLY be hittable AFTER Button A is pressed. Button B will then act like Button A for another dynamic Text Box.

    Essentially I want Button A (frame 10) to reveal Button B (frame 20) to reveal Text C (frame 30).


    This code is on Button A
    on (release) {
    door = "this is a clue"
    doorvar = door
    }

    It reveals text in dynamic TextBox A with Var = doorvar

    TextBox A is the Up/Over/Down state of Button B.

    Code on Button B
    on (release) {
    door2 = "this is a clue"
    doorvar2 = door2
    }
     
  2. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #2
    You would most likely get better help in the Web Design and Development forum seeing as Actionscript is primarily targeted at that platform.
     
  3. whooleytoo macrumors 603

    whooleytoo

    Joined:
    Aug 2, 2002
    Location:
    Cork, Ireland.
    #3
    This should do it:

    Code:
    // On setup..
    buttonB.enabled = false; // This prevents clicks, and over-states
    
    // Button A code:
    buttonA.onPress = function()
    {
        buttonB.enabled = true;
        // Anything else you want to do here...
    }
    
    Things to note:
    - That merely sets buttonB to disabled; you might want to hide the button as well (by setting the "_visible" property); or change its appearance to some kind of de-activated state; depending on your needs.

    - If the buttonB.enabled = false line is loose in frame one of that clip (as opposed to being inside a function), it may execute again, disabling the buttonB, if you gotoAndStop back to that frame. Just something to be aware of!
     
  4. creator2456 thread starter macrumors 68000

    creator2456

    Joined:
    Jul 10, 2007
    Location:
    Chicago
    #4
    Thanks. Got it working in simple terms, but still not quite how I want it. At least I have a starting point to go from now.
     

Share This Page