Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Childish Movieclips!

New Here ,
Sep 12, 2013 Sep 12, 2013

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

TOPICS
ActionScript
822
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 12, 2013 Sep 12, 2013

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

Translate
Community Expert ,
Sep 12, 2013 Sep 12, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 12, 2013 Sep 12, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 12, 2013 Sep 12, 2013
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines