A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: Multiline text isn't clearing with this code...

  1. #1
    Junior Member
    Join Date
    Oct 2010
    Location
    Wirral, England
    Posts
    8

    Multiline text isn't clearing with this code...

    Actionscript Code:
    form_comments.onSetFocus = function() {
    if (form_comments.text == "Your comments") {
    form_comments.text = "";
    }
    };

    my input field instance is form_comments and the default text I have in the field is "Your comments"

    the same code (with obvious changes) is working fine on my single line fields... just not this last one?

    Working example can be viewed at davey-martin.com

    much appreciate any help!

  2. #2
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,836
    when I was testing it out, it seemed like making it a multiline textfield would automatically add another character \n. just put form_comments.text = "Your comments"; above the function to put text in it instead of having it start with text.
    .

  3. #3
    Junior Member
    Join Date
    Oct 2010
    Location
    Wirral, England
    Posts
    8
    thanks for ur reply swak....

    on doing that it was clearing the input field when the movie loaded up...

  4. #4
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,836
    hmm. I'm not getting the same problem as you then. Could I see the fla please?
    .

  5. #5
    Junior Member
    Join Date
    Oct 2010
    Location
    Wirral, England
    Posts
    8
    sure... i've contained all of the actions for the input fields in "Actions: Frame 1"


    if u get a minute to check over the "page_contact" symbol too that would be greatly appreciated - i have AS on "contact submit" (my send button) and "eform_contact" (my text fields with variables matching the php file) but my form isn't working....

    i think everything is right as far as the AS goes (well, from following an online tutorial!) - if it is, then it must be the php file that needs correcting! lol

    thanks for your help!
    Attached Files Attached Files

  6. #6
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,836
    I'm sorry but I have CS4 so I can't open it. Try again.
    .

  7. #7
    Senior Member
    Join Date
    May 2010
    Posts
    178
    Actionscript Code:
    var comments = "Your comments";
    form_comments.text = comments;
    form_comments.onSetFocus = function() {
        if (form_comments.text == comments) {
            form_comments.text = "";
        }
    };
    form_comments.onKillFocus = function() {
        if (form_comments.text == "") {
            form_comments.text = comments;
        }
    }
    ;

    This is how it works. Check the Instance name of Multiline "Input Text Field".

    Poltuda

  8. #8
    Junior Member
    Join Date
    Oct 2010
    Location
    Wirral, England
    Posts
    8
    my apologies, didn't realise i could save an fla for different versions of flash!

    have saved for CS4 now...
    Attached Files Attached Files

  9. #9
    Junior Member
    Join Date
    Oct 2010
    Location
    Wirral, England
    Posts
    8
    thanks poltuda, it's clearly something i'm doing wrong in my projects as i just tried that in a new document and works perfectly... *scratches head*

  10. #10
    Junior Member
    Join Date
    Oct 2010
    Location
    Wirral, England
    Posts
    8
    right ok, so i've renamed my form and my two contained symbols (input fields together in a movie and my send button seperate)

    instances below:

    form = NL_form

    name field = NL_name
    email field = NL_email

    button = NL_btn (not relavent tho i guess)

    my AS is applied to NL_form as follows:

    Actionscript Code:
    onClipEvent (load) {
    var nlname = "Name / Company";
    NL_name.text = nlname;
    NL_name.onSetFocus = function() {
        if (NL_name.text == nlname) {
            NL_name.text = "";
        }
    };
    NL_name.onKillFocus = function() {
        if (NL_name.text == "") {
            NL_name.text = nlname;
        }
    }
    var nlemail = "Email address";
    NL_email.text = nlemail;
    NL_email.onSetFocus = function() {
        if (NL_email.text == nlemail) {
            NL_email.text = "";
        }
    };
    NL_email.onKillFocus = function() {
        if (NL_email.text == "") {
            NL_email.text = nlemail;
        }
    }
    }

    while i'm not getting any errors, the fields are just loading up blank/empty and i'm unable to enter any text? :-s ... anything stand out as to why this would happen?

  11. #11
    Senior Member
    Join Date
    May 2010
    Posts
    178
    Example:

    Poltuda
    Attached Files Attached Files

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