5 Replies Latest reply on Jun 10, 2007 2:29 PM by Newsgroup_User

    setting the font color in a flash text member

    wgb14 Level 1
      Hi all

      I am trying to set the color of my text in a flash text member using the script below but i get an error. Any idea why? many thanks

      on startmovie
      sprite(7).fontSize = 20
      sprite(7).font.color = rgb (153,153,51)
      end

        • 1. Re: setting the font color in a flash text member
          Level 7
          Text in flash is very different from text in Director. In order to be
          able to change any property of a text object in Flash, that object has
          to be addressable. Static text in Flash is not addressable. Dynamic,
          input or a text component are each addressable. Dynamic or input text
          properties can be addressed through the instance name of the text object
          or through the variable name attached to the object.

          A text component can be addressed through its instance name and then
          have either individual properties' attributes addressed or by creating a
          style sheet or style sheet object for the text component.

          Each of these options has unique syntax. Some may be set through the
          sprite instance and some need to be set through the cast member.
          • 2. Re: setting the font color in a flash text member
            wgb14 Level 1
            <<Each of these options has unique syntax. Some may be set through the
            sprite instance and some need to be set through the cast member.>>

            Ok I understand, but what is the syntax to set the font color in a flash text cast member. I tried

            sprite(6).color = rgb (153,153,51) but it color the sprite itself and not its text. Any other ideas?


            • 3. Re: setting the font color in a flash text member
              wgb14 Level 1
              There should be a specific property that i can address (either for the cast member or the sprite on the stage) to change the font color. I just have not been able to find that property so far. Any ideas?
              • 4. Re: setting the font color in a flash text member
                Level 7
                If you are using the flashComponents, then you need to consult the
                documentation that comes with Flash for the formatting information. To
                make changes, you need to set the style of the component. From
                Director, you can change the text color of a TextInput component like
                this (assuming your spite is in channel 1):

                sprite(1).setStyle("color","0xff0000")

                That will change the color to red.

                Other style options (for the flash TextInput component) are:

                backgroundColor
                borderStyle
                marginLeft
                marginRight
                disabledColor
                embedFonts
                fontFamily
                fontSize
                fontStyle
                fontWeight
                textAlign
                textIndent
                textDecoration

                You can find out what the current values are by using getStyle()

                put sprite(1).getStyle("color")
                -- "0xff0000"
                • 5. Re: setting the font color in a flash text member
                  Level 7
                  Place the sprite in the Object Inspector while the movie is running and
                  poke around in there looking for likely candidates to start addressing
                  and altering