A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: variable question

  1. #1
    Senior Member
    Join Date
    Aug 2002
    Location
    Ireland
    Posts
    194

    variable question

    I have a text box inside a movie clip called 'comment'.
    I have given the movie clip an ID of 1..
    How do I give the comment text box a value equal to "_root.comment"+id (I have a few of the clip's instances, each with a different ID.. so I cant just use comment = _root.comment1)..
    I have tried comment = "_root.comment"+id, but that returns a string...
    any ideas?

  2. #2
    Senior Member
    Join Date
    Sep 2001
    Location
    Top Shelf
    Posts
    757
    not sure exactly what you mean, but try this, or a simalar combination of this:
    code:

    _root.comment.text += String(id);

    This information is subject to change without notice and
    is provided "as is" with no warranty.

  3. #3
    Senior Member
    Join Date
    Aug 2002
    Location
    Ireland
    Posts
    194
    i just want to give the variable 'comment', inside the clip 'clip', the value of '_root.comment+[ID]'
    so if the clip had an id of 1, comment would get the value of _root.comment1
    if the clip had an id of 2, comment would get the value of _root.comment2
    etc. etc

  4. #4
    Senior Member
    Join Date
    Sep 2001
    Location
    Top Shelf
    Posts
    757
    you should use the _name property of an mc to recieve its instance name.
    This information is subject to change without notice and
    is provided "as is" with no warranty.

  5. #5
    Senior Member
    Join Date
    Aug 2002
    Location
    Ireland
    Posts
    194
    got it going..
    used:
    comment = _root["comment" + id];

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