1 Reply Latest reply on Oct 24, 2009 11:14 AM by TaoHunter

    attachMovie problem animating

    TaoHunter Level 1

      I have a bit of an odd problem with attachMovie.

       

      In my library I have several movies all build up in pretty much the same way.

      They are a couple of frames long with a different image on each frame.

      They have a color layer at 70% as sort of an overlay.

      And on top of that a layer with a movieclip to serve as a mask for the overlay.

       

      On the stage I have a movieclip named holder to attach them to and a couple of buttons to do that.

      The buttons execute the following function:

       

      resetVideo = function (idname, flvname) {
          my_video.clear();
          navholder.attachMovie(idname,"navigatie",1);
          my_video.attachVideo(stream_ns);
          stream_ns.play("FLV/"+flvname+".flv");
          trace("check")
      };

       

      This loads a movie into the my_video object and attaches one of the movieclips to the navholder.

      So far everything works fine. The video loads and the movieclips get replaced every time.

      But now comes the weird part.

       

      I'm animating the movieclips based on data that is received from cuepoints in the loaded movie and the script for that looks like this:

       

      stream_ns.onCuePoint = function(infoObject:Object) {
          if (infoObject.parameters != undefined)

              navholder.navigatie.gotoAndStop(infoObject.parameters.navs_Slider);
              navholder.navigatie.navmask._xscale =navholder.navigatie.navmask._yscale=parseFloat(infoObject.parameters.maskscale_Slider)*n avscale;
              navholder.navigatie.navmask._x = parseFloat(infoObject.parameters.maskposx_Slider)*navscale;
              navholder.navigatie.navmask._y = parseFloat(infoObject.parameters.maskposy_Slider)*navscale;

          }
      };

       

      The thing that happens now is that the gotoAndStop part works fine and the clip goes nicely through the frames but the animation of the mask doesn't work at all. I've checked the naming several times and when I place the clip directly on the stage the mask animation works fine. So somehow when I use the attachMovie command the link to the navmask instance gets either lost or it's not possible to animate it at all in an attached movieclip.

       

      If anyone could shed some light on this it would be highly appriciated.

       

      Grtz,

      TaoHunter

        • 1. Re: attachMovie problem animating
          TaoHunter Level 1

          Sigh... Problem solved:

           

          For the navscale in the formula

           

          navholder.navigatie.navmask._x = parseFloat(infoObject.parameters.maskposx_Slider)*navscale;

           

          I used the width of the navigatie object and I hadn't changed that one to navholder.navigatie._width so therefore the values all came back as NaN :/