4 Replies Latest reply on Aug 8, 2006 5:29 PM by darrendb

    input text and stylesheets

    Steve.Gurasich
      Is it possible to attach a stylesheet to an input text field and have that text pick up the style? I have dynamically created my own text fields, and have succesfully attached a stylesheet and written htmltext to use the style, that's not a problem. But when the text field is an input text field, I can't just specify a "<span class='xxx'></span>" or something to use as the default class for the text field, right? The goal is to have the text that the user types in styled by the stylesheet. I tried naming the CSS class "body" (I was hopeful..) but alas, my hopes were dashed like a lemming on a rock.

      Anyway, any help would be .. helpful. Thanks.
        • 1. Re: input text and stylesheets
          ginoxl
          Pretty sure u can use a .as file as an 'include' sheet....
          • 2. Re: input text and stylesheets
            Level 7
            Steve.Gurasich wrote:

            > Is it possible to attach a stylesheet to an input text field and have that text
            > pick up the style? I have dynamically created my own text fields, and have
            > succesfully attached a stylesheet and written htmltext to use the style, that's
            > not a problem. But when the text field is an input text field, I can't just
            > specify a "<span class='xxx'></span>" or something to use as the default class
            > for the text field, right? The goal is to have the text that the user types in
            > styled by the stylesheet. I tried naming the CSS class "body" (I was
            > hopeful..) but alas, my hopes were dashed like a lemming on a rock.
            >
            > Anyway, any help would be .. helpful. Thanks.
            >

            Sure it's possible

            http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context= LiveDocs_Parts&file=00001454.html

            -Richard
            • 3. Re: input text and stylesheets
              Steve.Gurasich Level 1
              Thanks for the reply.

              I understand how to apply CSS formatting to static or dynamic text, but what about input text?
              • 4. Re: input text and stylesheets
                darrendb
                I've been having similar problems with Input fields and styleSheets. I found this in a book, which goes against other documentation but seems to hit the spot of acknowledging a problem (no solution, however...)
                In the big red book, Macromedia Flash MX 2004 ActionScript 2.0 Dictionary by Macromedia Press, Chapter 8: Working with Text, Page 346:
                When you assign a style sheet object to a TextField object, the following changes occur to the textfield's normal behavior:
                • The textfields 'text' and 'htmlText' properties behave identically and always contain the same value
                • The textfield becomes read-only and cannot be edited by the user
                • The setTextFormat() and replaceSel() methods no longer function.
                • Any text assigned to the textfield (either via .text or .htmlText property) is stored verbatim, and can be retrieved in the text's original form

                This is a total kick in the head and contradicts the typical documentation statement that you can apply styleSheets to dynamic and input textfields.

                I don't know the answers, but that seems to confirm our findings...

                --

                d