3 Replies Latest reply on Aug 1, 2008 9:02 AM by Newsgroup_User

    Cast Member Script

    Level 7
      If I have a text member with a cast member script (not a behavior
      attached to a sprite) how can I reference the member's text property in
      that script without referencing the member by it's name? In other words,
      if the text cast member's name is "X" I am trying to avoid hard coding
      in the cast member script like

      member("X").text = "123"
        • 1. Re: Cast Member Script
          Level 7
          Dave C wrote:
          > If I have a text member with a cast member script (not a behavior
          > attached to a sprite)

          I recommend that you do yourself a favour and don't do that. Cast member
          scripts are quirky.

          Andrew


          • 2. Re: Cast Member Script
            Level 7
            Though In general I agree with Andrew, there are cases when, for cast
            clarity, you may want to attach simple scripts to members:
            sprite(the currentspritenum).member.text="123"


            "Dave C" <no@no.com> wrote in message
            news:g6t0rf$fo3$1@forums.macromedia.com...
            > If I have a text member with a cast member script (not a behavior attached
            > to a sprite) how can I reference the member's text property in that script
            > without referencing the member by it's name? In other words, if the text
            > cast member's name is "X" I am trying to avoid hard coding in the cast
            > member script like
            >
            > member("X").text = "123"


            • 3. Re: Cast Member Script
              Level 7
              I too have not used cast member scripts much in the past. But for small
              scripts that will not be reused anywhere else, it definitely seems more
              "clean" to use them. Thanks for the solution.


              alchemist wrote:
              > Though In general I agree with Andrew, there are cases when, for cast
              > clarity, you may want to attach simple scripts to members:
              > sprite(the currentspritenum).member.text="123"
              >
              >
              > "Dave C" <no@no.com> wrote in message
              > news:g6t0rf$fo3$1@forums.macromedia.com...
              >> If I have a text member with a cast member script (not a behavior attached
              >> to a sprite) how can I reference the member's text property in that script
              >> without referencing the member by it's name? In other words, if the text
              >> cast member's name is "X" I am trying to avoid hard coding in the cast
              >> member script like
              >>
              >> member("X").text = "123"
              >
              >