Skip to main content
Participating Frequently
December 20, 2007
Question

how do you reference an attached movie?

  • December 20, 2007
  • 4 replies
  • 235 views
Hello:

I am having some difficulty referencing a dynamically created attached movie (attached_popUp) created from the popUp_hitArea movie clip. It cannot seem to find its way into the attached movie? I have run a trace(this) from inside the attached movie to confirm the linking name...

THIS DOES NOT RETURN A TRACE STATEMENT:
_level0.popUp_hitArea.attached_popUp.onRollOver=function(){
trace("testing");
}

THIS DOES RETURN A TRACE STATEMENT:
_level0.popUp_hitArea.onRollOver=function(){
trace("testing");
}


THIS IS WHAT I USED TO ATTACH THE MOVIE IN THE FIRST PLACE:
_level0.roll_A_hotspot.onRelease=function(){
popUp_hitArea.attachMovie("popUp_ID", "attached_popUp", 1);
}


This seems like this must be something obvious?!? Any help would be greatly appreciated.


Thank you!

- Garrett


This topic has been closed for replies.

4 replies

Participating Frequently
December 20, 2007
Well if you say so(dr_ross), but I have done it that way many times to reference an attached movie and it seems to work fine. Although I think I should have had it access the name he set it to when he attached it, which would be _root["attached_popUp"] can't remember exactly.
December 20, 2007
that really won't do anything different, _root["popUp_hitArea"] is the same as writing _root.popUp_hitArea as you're just concating a straight string to reference the movie by name.

You'd use that to reference and object with dynamic referencing

i.e.

for(var i=0;i<10;i++)
{
this["myMovie_"+i]._x = 200;
}

instead of

this.myMovie_0._x = 200;
this.myMovie_1._x = 200;
this.myMovie_2._x = 200;
this.myMovie_3._x = 200;
this.myMovie_4._x = 200;
etc
Participating Frequently
December 20, 2007
You need to use _root["popUp_hitArea"] or eval("popUp_hitArea") to reference the attached movie. so it might go like this :

_root["popUp_hitArea"].onRollOver=function(){
trace("testing");
}

hope this helps
MattCanoe
December 20, 2007
First step is to ask is the attachedMovie actually visible? if its not it could be due to using 1 as the depth in attachMovie, use getNextHighestDepth() instead,
depending on how all this code is scoped, you might need to prefix your attach with _level0

_level0.roll_A_hotspot.onRelease=function(){
_level0.popUp_hitArea.attachMovie("popUp_ID", "attached_popUp", _level0.popUp_hitArea.getNextHighestDepth());
}

If its visible then you could iterate through all the objects in _level0.popUp_hitArea and find out whats inside with

for(var obj in _level0.popUp_hitArea)
{
trace("Found "+obj+":"+_level0.popUp_hitArea[obj]);
}

Otherthan using the evil _level0 prefix it looks alright