Link to home
Start Free TrialLog in
Avatar of ndcollins
ndcollins

asked on

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?
Avatar of Ramy_atef
Ramy_atef

Hi
this could be a targeting problem ...
It would be much better if you sent the fla

Regards,
Ramy
Avatar of ndcollins

ASKER

ASKER CERTIFIED SOLUTION
Avatar of wings_gaurav
wings_gaurav

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Wings! That worked!