2 Replies Latest reply on Apr 25, 2006 5:04 AM by Newsgroup_User

    accessing a nested movieclip

    Level 7
      I have an movieclip "menu_item_assembly" with an emty scene and another clip
      "red_ball" which has a picture of a ball in its scene

      Then in "menu_item_assembly" I have a code
      attachMovie("red_ball","red_ball",1)

      Then in the scene1 of the root clip I have a code

      attachMovie("menu_item_assembly","time_menu",time_menu_depth); //line1
      trace(typeof(time_menu)); //line2
      trace(typeof(time_menu.red_ball)); //line3

      line1 shows the red ball
      line2 shows "movieclip"
      line3 shows "undefined"

      It looks like I address time_menu.red_ball wrongly. How do I addess it
      correctly?




        • 1. Re: accessing a nested movieclip
          blemmo Level 1
          The path should be right, the reason it traces "undefined" is another one: Flash first executes all code in the _root's frame, and only if this is through, the code in the attached movie is executed. So the ball movie isn't attached yet when the trace code executes, thus returning "undefined". Add a frame in the _root timeline and place the traces there, and it should return "MovieClip" instead of "undefined".

          cheers,
          blemmo
          • 2. Re: accessing a nested movieclip
            Level 7
            Thank, Blemmo, for very interesting detail

            "blemmo" <webforumsuser@macromedia.com> wrote in message
            news:e2l117$hjf$1@forums.macromedia.com...
            > The path should be right, the reason it traces "undefined" is another one:
            > Flash first executes all code in the _root's frame, and only if this is
            > through, the code in the attached movie is executed. So the ball movie
            isn't
            > attached yet when the trace code executes, thus returning "undefined". Add
            a
            > frame in the _root timeline and place the traces there, and it should
            return
            > "MovieClip" instead of "undefined".
            >
            > cheers,
            > blemmo
            >