A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: using the if statement with an edit box

  1. #1
    Junior Member
    Join Date
    Nov 2008

    using the if statement with an edit box

    hi, i have searched previous posts and i am a little stuck

    all i want to do is to enable a user to check that what they have written in an edit box is the correct answer or not

    var element ("correct")
    var element ("try again")
    var element ("input") = "3"

    if (input="3")
    element ("correct").show();
    element ("try again").show()

    and what happens is no matter what is written in the edit box, "correct" shows up

  2. #2
    Senior Member
    Join Date
    Jun 2007
    Nottingham, England
    Maybe I'm wrong but to me none of that code looks right. Never seen syntax like that before in actionscript.

    Create an input text box called "input" and a button with the instance name "check":

    PHP Code:
    check.onPress = function() {
    if (
    input.text == 3) {
    } else {
    trace("try again");
    You could of course change the trace action so it displays the result in another text box or something but that's just an example.

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