djsodom
02-08-2005, 07:46 PM
I have a custom class that inserts an icon on the cell that is clicked within a datagrid. The problem I'm faced with is removing that icon once you click on another cell. The problem is that there are so many layers of movieclips within a cell that I can't get to the right target. For example,there is the datagrid clip, then one called content_mc, then listRowX, then fCellX, then my clip.
For example, if I do something like:
trace ("hello: " + listOwner.content_mc);
//trace ("this: " + iconActive);
//Remove any previous icons
for (var name in listOwner.content_mc) {
if (typeof (listOwner.content_mc[name]) == "movieclip") {
trace("I have a movie clip child named "+name);
}
} That only gets me to the content_mc level. The number of listRowX's I have to iterate through is dependent on the number of rows I have. And then under each one of those, I would have to iterate through fCellX. Which seems very wasteful just so I can remove a clip.
I thought about storing the value of the target cell with something like:
//add the icon
iconActive = this.attachMovie("glassActive", "iconActive", 1);
trace ("print: " + iconActive);
set ("tracker", iconActive)
trace (tracker);
The compiler complains on this because "tracker" is not defined as a variable in my class. If I could store the target of iconActive clip once it is created and then retrieve this target before creating it again,then it seems like I could remove iconActive.
Is there an easier way? Or, how can I store a variable to reuse again in my class?
Thanks,
Steve
For example, if I do something like:
trace ("hello: " + listOwner.content_mc);
//trace ("this: " + iconActive);
//Remove any previous icons
for (var name in listOwner.content_mc) {
if (typeof (listOwner.content_mc[name]) == "movieclip") {
trace("I have a movie clip child named "+name);
}
} That only gets me to the content_mc level. The number of listRowX's I have to iterate through is dependent on the number of rows I have. And then under each one of those, I would have to iterate through fCellX. Which seems very wasteful just so I can remove a clip.
I thought about storing the value of the target cell with something like:
//add the icon
iconActive = this.attachMovie("glassActive", "iconActive", 1);
trace ("print: " + iconActive);
set ("tracker", iconActive)
trace (tracker);
The compiler complains on this because "tracker" is not defined as a variable in my class. If I could store the target of iconActive clip once it is created and then retrieve this target before creating it again,then it seems like I could remove iconActive.
Is there an easier way? Or, how can I store a variable to reuse again in my class?
Thanks,
Steve