A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Button skips actionscript

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

    Button skips actionscript

    Hi

    this is the code inserted for the actions of a "submit" button:


    on (release) {
    if (msgb eq "") {
    errormsg("Please enter a comment.");
    } else if (nameb eq "") {
    errormsg("Please enter a name.");
    } else {
    unknown = "NO";
    gotoAndPlay("record");
    }
    }


    The weird thing: if you click on the button (and all the fields are not filled in), the form will be submitted (he goes to "record"). If you click a second time on the submit button (with still all fields not filled in), then he will give an error (please enter a comment).

    What's the problem?

    You can see this working at www.djmark.be -> contact -> guestbook

    Thx!

  2. #2
    Member
    Join Date
    Sep 2004
    Location
    Columbia, MD
    Posts
    60
    I am not getting this problem. I am getting an error on the first try.

    However, you definitely need to add a loading screen. I would suggest adding it to the blank page. I almost reloaded the site becuase I didn't know if the flash movie was broken. (it took a little while to load...)

  3. #3
    Junior Member
    Join Date
    Sep 2001
    Posts
    3
    That's very strange. I still get an error at the second click and not at the first click.

    Thanks for the tip about the loading page.

  4. #4
    Member
    Join Date
    Sep 2004
    Location
    Columbia, MD
    Posts
    60
    you know what? when I tried it from home that's what happened. The first click didn't generate an error, but subsequent clicks did.... hrm.. let me look into this...

  5. #5
    Member
    Join Date
    Sep 2004
    Location
    Columbia, MD
    Posts
    60
    In the mean time, you may want to play with trace statements:

    on (release) {
    if (msgb eq "") {
    errormsg("Please enter a comment.");
    debug.trace("msgb = " + msgb);
    debug.trace("the comment field was empty so I threw an error.");
    } else if (nameb eq "") {
    errormsg("Please enter a name.");
    debug.trace("nameb = " + nameb);
    debug.trace("the name field was empty so I threw an error.");
    } else {
    debug.trace("nameb = " + nameb);
    debug.trace("msgb = " + msgb);
    unknown = "NO";
    gotoAndPlay("record");
    }
    }


    Also, what is the "unknown" variable? what does it reference and why are you setting it to "NO"?

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