A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Input text box eats my insertion marker!

  1. #1
    Member
    Join Date
    May 2002
    Posts
    62
    Hey folks, here's the deal...
    I've created a dynamically generated input text box, and formatted it using the following code:
    //--------------
    _root.createTextField("myText", 100, 50, 120, 350, 28);
    myText.type = "input";
    myText.border = true;
    myText.background = false;
    myText.multiline = false;
    myText.html = false;
    myText.embedFonts = true;
    myText.variable = _root.myTextFieldName;
    myText.maxChars = 50;

    myTextFormat = new TextFormat();
    myTextFormat.color = 0xFF0000;
    myTextFormat.font ="Arial";
    myTextFormat.size = 18;
    myText.text = "Yippee! It works!";
    myText.setTextFormat(myTextFormat);
    //-------------------

    The problem is that if I put default text in the box, if the user uses the *backspace* key to remove the default text then the insertion marker disappears, never to be seen again. That's what happens if you embed the font..
    However, if you DON'T embed the font, then removing the default text with *backspace* removes the text formatting... arg.
    If I don't put ANY default text in the box to start with, then the insertion marker simply isn't there at all.
    Did any of that make sense?
    You can see an example of the 3 scenarios at:

    http://www.neteze.com/luminous/test/texttest3.swf

    I don't get it, can someone help get my brain straightened out on what's happening? And how to make it stop...
    Thanks much...

  2. #2
    Member
    Join Date
    May 2002
    Posts
    62
    Awww, c'mon. Nobody's played with dynamically generated text boxes enough yet to have any input...?

  3. #3
    Senior Member
    Join Date
    Mar 2000
    Posts
    210
    have exactly the same problem!!!
    seems to be a progam bug.
    need this function to work further on.....

  4. #4
    Senior Member
    Join Date
    Mar 2000
    Posts
    210
    found the solution:
    use setNewTextFormat instead of setTextFormat within
    the createTextField object.

  5. #5
    Member
    Join Date
    May 2002
    Posts
    62
    tolgot wrote:
    found the solution:
    use setNewTextFormat instead of setTextFormat within
    the createTextField object.

    Yeow! Just when I thought the thread was dead, and I was out of luck, along comes someone with an answer.. How I love FK! I won't have much chance to play with the text boxes for a couple days but I will most certainly give "setNewTextFormat" a try ASAP. Thanks ever so much for the reply! Errr, so how did you discover using setNewTextFormat instead of setTextFormat?
    Thanks again!

  6. #6
    Junior Member
    Join Date
    Sep 2002
    Posts
    13
    I seem to having the same kind of problems - with some additions -
    when using mytext.type = "input" ? My text box sometimes becomes disabled (cant type in there) - but if I prepopulate it with something ie mytext.text = "sdfsdf", then I can delete it and re-type something in there..... not sure if I'm doign anything wrong

    HELP.......

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