3 Replies Latest reply on Feb 28, 2009 7:49 PM by kmdguy

    How to reference a component using a variable?

      Hi there,

      Kind of a dumb question but I can't find the right syntax to reference a component by using a variable to represent its ID. For example I have some simple labels that I want to reference in a loop. Each label's ID follows this naming structure:

      id ="scene2Title"... on through to "scene20Title"

      When I create a loop like below I keep getting an error "access of undefined property component". How to write the syntax so that I can just reference a component's properties by using a variable? In Director Lingo this was quite simple.

      var i:int;
      for (i = 0; i < 20; i++) {
      var labelName:String = "scene"+i+"Title";

      if (labelName.length == 0)
      labelName.text="Some text";