Copy link to clipboard
Copied
Hi All,
I'm having a bit of trouble with using addChild. I'm building a diagram which can zoom into specific details when the user clicks. So far i start off with the diagram at stage size on the main timeline. I have an invisible movieclip with the registration point at its center just off the stage. When the user clicks on the object within the diagram they want to enlarge i create a new point at the center of the object and then align the invisible clip to this point. Then i use addChild to add the diagram image to the container and i then enlarge the container itself to create the zoom effect. I then center the container to the middle of the stage. This works ok. The problem comes when i want to address the objects within the diagram. say i want to make one invisible, i would write: container.diagram.object1.visible = false; To me this should work as that is how i would normally address a nested clip!? It doesnt work because i've dynamically added the diagram to its container. Flash seems to be getting confused with it somehow. Is there a way around this? Am i using the wrong code or can you just not talk to a clip once its been nested with addChild?!
Any help would be massively appreciated...
Many Thanks
Matt
using addChild doesn't change how an object is referenced.
if you have
var mc:MovieClip=new MovieClip();
p1.p2.addChild(mc);
the correct reference is mc, not p1.p2.mc
only if mc is added to the p2 timeline in the ide, would you use p1.p2.mc
Copy link to clipboard
Copied
using addChild doesn't change how an object is referenced.
if you have
var mc:MovieClip=new MovieClip();
p1.p2.addChild(mc);
the correct reference is mc, not p1.p2.mc
only if mc is added to the p2 timeline in the ide, would you use p1.p2.mc
Copy link to clipboard
Copied
Thankyou Kglad, I could'nt see the wood for the trees! Works as described on the test file i've just created will try it at work tomorrow on the actual project.
Many Thanks
Matt
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now