3 Replies Latest reply on Jan 15, 2013 6:12 AM by Ned Murphy

    How can I attached a drawn obj to a movie-clip?

    pa-pavel Level 1

      Hi,

       

      I am trying to add a drawn obj to a exisiting moving MovieClip.

      Can this be done or do I have to draw the obj inside the MovieClip?

       

      obj1.onEnterFrame = function()

      {

                if (obj1._x < 500)

                {

                          obj1._x += 5;

                }

                else if (obj1._x > 500)

                {

                          obj1._x = 0;

                };

      };

       

       

      createEmptyMovieClip("drawnbox",getNextHighestDepth());

      drawnbox.beginFill(0x00FFFF);

      drawnbox.moveTo(0,0);

      drawnbox.lineTo(50,0);

      drawnbox.lineTo(50,50);

      drawnbox.lineTo(0,50);

      drawnbox.lineTo(0,0);

      drawnbox.endFill();

      drawnbox.cacheAsBitmap = true;

       

       

      I tried this but no effect:

      obj1.attachMovie("obj2","obj2",_root.obj1.getNextHighestDepth());

       

      Cheers P.

        • 1. Re: How can I attached a drawn obj to a movie-clip?
          Ned Murphy Adobe Community Professional & MVP

          The attachMovie method is for loading content from the library thru the use of linkage identifiers. 

           

          I do not see the connection in what you show between the movieclip that you create and draw in versus the "obj2" you try to use attachMovie with.

           

          If you want to have the drawing put inside obj1, then create the movieclip inside obj1 and draw into it...

           

          obj1.onEnterFrame = function()

          {

                    if (obj1._x < 500)

                    {

                              obj1._x += 5;

                    }

                    else if (obj1._x > 500)

                    {

                              obj1._x = 0;

                    };

          };

           

          obj1.createEmptyMovieClip("drawnbox",obj1.getNextHighestDepth());

          obj1["drawnbox"].beginFill(0x00FFFF);

          obj1["drawnbox"].moveTo(0,0);

          obj1["drawnbox"].lineTo(50,0);

          obj1["drawnbox"].lineTo(50,50);

          obj1["drawnbox"].lineTo(0,50);

          obj1["drawnbox"].lineTo(0,0);

          obj1["drawnbox"].endFill();

          obj1["drawnbox"].cacheAsBitmap = true;

          • 2. Re: How can I attached a drawn obj to a movie-clip?
            pa-pavel Level 1

            Ty fir the reply! rly appriciate it! Pavel

            • 3. Re: How can I attached a drawn obj to a movie-clip?
              Ned Murphy Adobe Community Professional & MVP

              You're welcome

              1 person found this helpful