A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Enable/disable button thru external variable?

  1. #1
    Junior Member
    Join Date
    Sep 2001
    Posts
    3

    Enable/disable button thru external variable?

    I am writing a CD-ROM menu application using Flash MX2004 and want to be able to enable or disable a button from displaying based on a variable set in an external text file.

    I've created a textfile with :

    displaybutton=1

    What I don't know how to do is work out the actionscript to say 'If displaybutton=1 then enable the button'.

    I tried adding an if/else statement to the On Release, so that if it was not 1 it would send the user to another scene, but this did not work (making me think that perhaps it was not reading my variable correctly).

    Can anyone help?

    Martin B

  2. #2
    Actionscript Developer KigD's Avatar
    Join Date
    Jan 2003
    Location
    georgia
    Posts
    597
    // This is assuming you've properly loaded the variable into flash.
    on(release){
    if (_root.displaybutton == "1")
    {
    // w/e
    }
    else
    {
    //w/e
    }
    }
    K2xL - My games, tutorials, message boards, and experiments.
    Blog

  3. #3
    Junior Member
    Join Date
    Sep 2001
    Posts
    3
    This is of course assuming I understand this! Unfortunately I find actionscript difficult to get my head around, and while I understand the 'if' script below I am not sure what to put in the // w/e bits - e.g. what is the command to display the button or layer? Which would be the better way - enable a button or enable a layer? The 'else' bit I assume I'd just leave empty to not display anything.

    Also, how can I confirm that the variable is being loaded correctly? I have often read in text files and displayed the content in a dynamic text box using:

    loadVariablesNum("filename.txt", 0);

    Is this correct? (Just making sure )

    Sorry for the simple questions but as I say it's hard to bridge the learning curve when you're at the bottom of the straight line!!!

    Thanks
    Martin B

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