A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Still wondering!?

  1. #1
    Senior Member
    Join Date
    Jan 2004
    Location
    Canada
    Posts
    309

    Still wondering!?

    Hey guys I know I asked this very same question before but got nothin really. I need it so that when I click on a text box it clears the box so the user can type into it. does anyone know how to do this. I know how with an html box but just cant figure this out. pleasehelp me. thanks.



    matt

  2. #2
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    Suppose you have two input fields with instance names tf_input1 and tf_input2, you could use the following code:
    code:

    INPUTNOTSETMESSAGE = "<CLICK HERE TO ENTER TEXT>";
    tf_input1.onSetFocus = formSetFocus;
    function formSetFocus(oldFocus) {
    if (this.text == INPUTNOTSETMESSAGE) {
    this.text = "";
    }
    }
    function formKillFocus(newFocus) {
    if (this.text == "") {
    this.text = INPUTNOTSETMESSAGE;
    }
    }
    tf_input1.onSetFocus = formSetFocus;
    tf_input1.onKillFocus = formKillFocus;
    tf_input1.onKillFocus();
    tf_input2.onSetFocus = formSetFocus;
    tf_input2.onKillFocus = formKillFocus;
    tf_input2.onKillFocus();


    (Two fields only necessary to show it working properly!)

  3. #3
    Senior Member
    Join Date
    Jan 2004
    Location
    Canada
    Posts
    309
    I dont understand... where do I put that code? do you think u could make me a sample file just let me see how that works because that didnt make sense to me. Thanks alot.



    matt

  4. #4
    Senior Member
    Join Date
    Jan 2004
    Location
    Canada
    Posts
    309
    NVM. again I just needed to think a little harder. Thanks alot.







    matt

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