Timeline control of dynamic MC instance

Okay, here's my problem. I am creating a number of movieclips dynamically using the following code:

for (item=0; item<total; item++) {
      createLink("tLink"+item, tLink);
}

function createLink(newObj, aNode) {
      duplicateMovieClip(_root.baseLink, newObj, depthCount++);
      var tcl = eval(newObj);
      xPos += 30;
      setName(tcl, item+1, 1);
      tcl._x = xPos;
}

This works great. What I need it to also do is "highlight" the current object, so in the baselink MC I created a frame with the name "selected" and changed the tint to give it a highlight effect.

Doing a trace on "tcl" I get the names of the movieclips created as:
_level0.tlink0
_level0.tlink1
_level0.tlink2
and so on.

I wrote a function to select the current tlink as follows:
function selectLink(link) {
      link.gotoAndPlay("selected");
}

and call with:
selectLink("tLink"+item);

now, "link" is tracing out to tlink0 to start, but the movieclip is not performing the gotoAndPlay action. Even when I hardcode it with tlink0.gotoAndPlay("selected"); it still does not run. I tried adding _root. or _level0. and still does not play.

Does anyone have any idea why this is?
ndcollinsAsked:
Who is Participating?
 
wings_gauravCommented:
try this -

function selectLink(link)
{
     _root[link].gotoAndPlay("selected");
}


-wings
p.s. haven't had a look - if this doesn't work then let me know.
0
 
Ramy_atefCommented:
Hi
this could be a targeting problem ...
It would be much better if you sent the fla

Regards,
Ramy
0
 
ndcollinsAuthor Commented:
0
 
ndcollinsAuthor Commented:
Thanks Wings! That worked!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.