I've created an instance of the TileList, and need too change the alpha of a textfield that appears inside the movie clips. How do I access a movieclip inside of the TileList so I can update the text alpha?
var backgroundList:TileList = new TileList();
// Add four images to the TileList instance
backgroundList.addItem({source:"bg1_mc"});
backgroundList.addItem({source:"bg2_mc"});
backgroundList.addItem({source:"bg3_mc"});
backgroundList.addItem({source:"bg4_mc"});
backgroundList.addItem({source:"bg5_mc"});
backgroundList.addItem({source:"bg6_mc"});
backgroundList.addItem({source:"bg7_mc"});
backgroundList.addItem({source:"bg8_mc"});
backgroundList.addItem({source:"bg9_mc"});
backgroundList.addItem({source:"bg10_mc"});
// Set scroll bar direction
backgroundList.direction = ScrollBarDirection.HORIZONTAL;
preview_mc.addChild(backgroundList);
This does not work:
preview_mc.backgroundList.bg1_mc.text_txt.alpha = 0;
this does not work:
preview_mc.backgroundList[1].text_txt.alpha = 0;
this does not work:
var foo=backgroundList.getItemAt(1).source;
foo.text_txt.alpha = 0;
I'm really at a loss. I've been searching for a solution everywhere for 4 hours and the TileList component is poorly documented.
Unfortunately, there doesn't seem to be a method to access the contents of a TileList
.
What you're accessing when you use getItemAt
is actually the Object
you added using addItem
.
So when you call backgroundList.getItemAt(1).source
all you're getting back is the String
"bg2_mc" which is just the linkage identifier of the symbol of your library, not the instance of that symbol that was added to the display list.
Not only is there no way in the API to do this, even traversing the entire display list of the TileList
doesn't come up with any answers:
[object ScrollBar]
[object BaseButton]
[object LabelButton]
[object TextField]
[object BaseButton]
[object BaseButton]
[object ScrollBar]
[object BaseButton]
[object LabelButton]
[object TextField]
[object BaseButton]
[object BaseButton]
[object Sprite]
[object Sprite]
There doesn't appear to be any trace of the MovieClips that were added.
This shows us that the TileList
is comprised of 2 instances of ScrollBar
and one Sprite
, and that the Sprite
has a single child Sprite
which has no further children.