Reset button on form not working
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Reset button on form not working

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    5

    Reset button on form not working

    Hi,
    I am working on a flash site that was done by someone else. I have never used actionscript before so I am sooo new at this. There is a reset button on the form so when people accidentally type in something, they can just click on the "reset" button and it clears all fields. The problem is that it's not clearing.

    This is what I have in the code for the button:
    on (release) {

    fullName = "";

    address = "";

    message = "";

    }


    The three (fullName, address and message) are the names of my variable when you select each input field. Where am I going wrong with this? Nothing happens when I click it.

    Thanks!

  2. #2
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,809
    You still haven't cleared the textfields. If you are using three variables (fullName, address, and message) you still have three textfields with their own instance name (txtfullName, txtaddress, so on). You need to get the instance name of the field.

    Select the textfield, and check the instance name field in the properties window. When you have that information you need to add the following code (remember to replace my example field name with the actual field name).

    Code:
    on (release)
    {
        fullName ="";
        address = "";
        message = "";
        txtfullName.text = "";
        txtaddress.text = "";
        txtmessage.text = "";
    }
    You could condense it, but it works either way.
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

  3. #3
    Junior Member
    Join Date
    Mar 2009
    Posts
    5
    Does that work only when you put it on the web? When I publish preview it in flash it doesn't seem to work. I copied it exactly as you put it and placed it in the actions when I clicked on the reset button. Also, I don't know if this affects it or not but the text fields are an instance of them. Do the actual text fields have to be on that "page" for the code to work? Thanks again for your help. I really appreciate it.

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

Poll by Flashkit.com