Flash MX - text fields...wrapping?
A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Flash MX - text fields...wrapping?

  1. #1
    Junior Member
    Join Date
    Mar 2002
    Posts
    7

    Post

    Is there any way to dynamically set the "character width" of a text field? I don't want the text to stretch - I want the text to wrap according to the width of the field, as text would in a text editor when you resize the window.

    Any guesses?


  2. #2
    Senior Member
    Join Date
    Feb 2002
    Posts
    147
    Using a whole bunch of actionscript, you can do that now in Flash 5.
    Have a look at this tutorial:

    http://www.actionscripts.org/tutoria...on/index.shtml

    But maybe it'll be a little easier in flash MX.

    #


  3. #3
    Information Architect Subway's Avatar
    Join Date
    Feb 2000
    Location
    Switzerland
    Posts
    4,779
    There are much more functionality to textfields. You can create a WYSIWYG editor when I intepreted one Flashguru post lately right. (Can't find it right now, maybe on were-here)

    Fredi

  4. #4
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    If you do this:

    Code:
    //create a new textfield with wordwrap
    //this.createTextField("instance_name",1depth,x,y,width,height)
    this.createTextField("mytext",1,0,0,200,100)
    mytext.wordWrap=true
    Then if you put some text into the textfield:

    Code:
    i=10
    while(--i){
        mytext.text+="another line of text\n";
    }
    Then if you change the width of text textfield using:

    Code:
    mytext._width=10
    The text will wrap accordingly.

  5. #5
    Information Architect Subway's Avatar
    Join Date
    Feb 2000
    Location
    Switzerland
    Posts
    4,779
    Thx Guy!

    Fredi

  6. #6
    [Devil in DarkGreen]

    Join Date
    Aug 2000
    Posts
    523
    hi,guru

    thx your coding,and i want add some talk:

    textfield should has 16 width at least or it cannot work correctly.
    and you can control its height-> mytext._height=number;


    DS

  7. #7
    Information Architect Subway's Avatar
    Join Date
    Feb 2000
    Location
    Switzerland
    Posts
    4,779
    @guy or demons: Is there a way to check where the cursor and the selected areas (in the textfield) is? That would make a lot more possible.

    Fredi
    [Edited by Subway on 03-10-2002 at 12:37 PM]

  8. #8
    [Devil in DarkGreen]

    Join Date
    Aug 2000
    Posts
    523
    sure,you can get them from seletion object


    selection.getbeginindex();
    selection.getendindex();


    DS

  9. #9
    Information Architect Subway's Avatar
    Join Date
    Feb 2000
    Location
    Switzerland
    Posts
    4,779
    Thx demons! That makes the project I'm thinking about a lot the last days possible. Thx MM for the new texfield object.

    Fredi

  10. #10
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    textfield should has 16 width at least or it cannot work correctly.
    and you can control its height-> mytext._height=number;
    Depends on the font, if you use the |(pipe) symbol and other such like, then the textfield can be two pixels wide if you want it to be.


  11. #11
    [Devil in DarkGreen]

    Join Date
    Aug 2000
    Posts
    523
    ok,thx,guy.

  12. #12
    Flash Product Manager
    Join Date
    Mar 2002
    Posts
    140
    Flash MX will make this much easier. Just a few more days... :-)

    MD

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