dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: HELP ME... sounds so simple but deadline blocking my brain... :(

  1. #1
    Senior Member
    Join Date
    Nov 2000
    Location
    London - UK
    Posts
    191

    HELP ME... sounds so simple but deadline blocking my brain... :(

    Hi there,

    urgently need to figure out how to restrict the amount of text in input box....

    I'm working on a training CDRom where there are interactive pages for people to keep notes and do the tasks. I need to make sure that the boxes with the text input do not exceed their own size, ie not shift text up when there is no more space - if that makes sense....

    I've tried counting the characters (to add the number into the 'MaxCaracters') via text mock up but it just doesn't quite seem to work perfectly, depending on text typed in, it works with certain bits of text and doesn't with other bits.... do to with the width of characters, I guess...

    Does anyone know of anything that would help me here? Any thought? Tips? Or tricks?

    Please have mercy on my poor brain - deadline creeping up on my and I can't see a way out... :'( :'(
    ___carpe_diem___

  2. #2
    Senior Member timBertrand's Avatar
    Join Date
    Mar 2004
    Posts
    213
    Just mess around with the Max Characters thing and USE A MONOSPACE FONT! That's the key right there. Courier New is one. Monospace means that each character has exactly the same width. Then all you have to do is mess around with Max Characters until it fits correctly.

    Hopefully the people using the CD-Rom won't mind the old-school fontage

    Alternatively, you could just slap a scroll bar on it. Then again, I don't know the application so that may not be a possibility.

    Regardless, happy flashing.

    -Tim
    Last edited by timBertrand; 03-21-2004 at 11:05 AM.

  3. #3
    Senior Member
    Join Date
    Nov 2000
    Location
    London - UK
    Posts
    191
    Tim,
    thanks for that... but sadly I had thought of that - but it can't be done. The client absolutely wants the font to be ComicSans which has the extreme difference in character width.... :'(
    But we're stuck with using Verdana for body text and ComicSans for all interactive bits, such as the text boxes..... That's why I'm so stuck :'(

    Thanks anyway
    ___carpe_diem___

  4. #4
    Senior Member timBertrand's Avatar
    Join Date
    Mar 2004
    Posts
    213
    Is the scrollbar a definite no-go? It's not like the client wouldn't be able to figure it out... let's hope

    If they're adamant about that, too, you could just assume each character will be the maximum width possible (likely the width of the capital M) the downfall of this obviously being if they input a bunch of lowercase I's they'll only be able to fill about half the allotted space

    If you're really eager to please the client (personally I'd just give them the damn courier new) you could meticulously go through each character, record its width in an array and then reference it each time that letter is typed.
    Then you'd have a variable (curLinePx) keeping track of the current line's length in pixels and when it goes over the text box's width, increment a numLines variable and reset itself. Then you could just disable the text-box when it reaches the maximum number of lines.

    This of course would take you hours and would make any sane person not so sane anymore. But, if it must come to it, that certainly is an option.

  5. #5
    Senior Member
    Join Date
    Nov 2000
    Location
    London - UK
    Posts
    191
    well, that just sounds a bit too steep for me.... too involved, I think I'll have to go the counting the "m"s....

    The scroll bar is out of the question.

    Thanks for your thoughts and ideas
    ___carpe_diem___

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