A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Find line break into text field

  1. #1
    Can i play now????
    Join Date
    Jun 2003
    Location
    Greece
    Posts
    309

    Find line break into text field

    Hi everybody,
    i have a movie clip with 2 text fields (one input and one Dynamic). The user types something into the Input type textfield and by pressing a button this text moves to the Dynamic Textfield.
    I use this to do it:
    code:

    on(release){
    _root.dynamic_text += _root.input_field + "\n"
    }



    Then from this dynamic text i want to find where there is a line break (\n) to perform an action (like add something).
    Does anybody knows how to do it?
    Mess With The Best, Die Like The Rest...

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    code:

    posn = _root.dynamic_text.indexOf('\n');
    if (posn > -1) {
    trace("position is " + posn);
    }
    else {
    trace("line break not found\n");
    }



    Other string functions you find useful are substr() and split(), both of which can be used to manipulate and insert things into the string.

  3. #3
    Junior Member
    Join Date
    Nov 2006
    Posts
    11
    Thanks alot for the help
    Last edited by success10; 11-07-2006 at 10:48 AM. Reason: Wrong post

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