1 Reply Latest reply on Jun 3, 2006 12:44 PM by TimSymons

    Undefined _x, _y, ... parameters when calling SWF movie

    rechin


      Extremely confused about an issue.

      I have the following action script in my "AA.fla":
      i = 1;
      while (i<=4) {
      markerbackx = getProperty(_root.menuclip.markerback, _x);
      markerbacky = getProperty(_root.menuclip.markerback, _y);
      backx = getProperty(_root.menuclip.back1, _x);
      backy = getProperty(_root.menuclip.back1, _y);
      menuscaley = getProperty(_root.menuclip.back1, _yscale);
      menuscalex = getProperty(_root.menuclip.back1, _xscale);
      markscalex = getProperty(_root.menuclip.markerback, _xscale);
      markscaley = getProperty(_root.menuclip.markerback, _yscale);
      diffbackx = markerbackx-backx;
      diffbacky = markerbacky-backy;
      diffscalex = markscalex-menuscalex;
      diffscaley = markscaley-menuscaley;

      movey = differencey/4;
      movex = differencex/4;
      backmovex = diffbackx/19;
      backmovey = diffbacky/19;
      zoomx = diffscalex/15;
      zoomy = diffscaley/15;

      trace ("_root = "+_root);
      trace ("i = "+i);
      trace ("markerbackx = "+markerbackx);
      trace ("markerbacky = "+markerbacky);
      trace ("backx = "+backx);
      trace ("backy = "+backy);
      trace ("menuscalex = "+menuscalex);
      trace ("menuscaley = "+menuscaley);

      setProperty (_root.menuclip.back1, _x, Number(backx)+Number(backmovex));
      setProperty (_root.menuclip.back1, _y, Number(backy)+Number(backmovey));
      setProperty ("_root.menuclip.menu"+i, _y, Number(menuy)+Number(movey));
      setProperty ("_root.menuclip.menu"+i, _x, Number(menux)+Number(movex));
      setProperty ("_root.menuclip.back1", _xscale, Number(menuscalex)+Number(zoomx));
      setProperty ("_root.menuclip.back1", _yscale, Number(menuscaley)+Number(zoomy));
      i = i + 1;
      }

      If I run this AA.swf on its own, I can get some animation (movement is based on previous x, y position and scale). Should be pretty straight forward. My tracing shows expected values as well -- all is fine and dandy. Here, _root is evaluated as _level0.

      Now, I am using AA.swf in BB.fla, like so:

      on (release) {
      mov_06.loadMovie("AA.swf");
      }

      where mov_06 is just a movie_clip object. This loadMovie command works okay for running my other .swf's which I load using the exact same method.

      Somehow, when I do this, I get no animation in the loaded AA.swf and it seems to be because the _x, _y, _xscale, _yscale values are "undefined" according to my trace. _root is still "_level0", so I can't see what's wrong with this.

      Would be great if you can offer some help!

      Much appreciated in advance,
      Kay
        • 1. Re: Undefined _x, _y, ... parameters when calling SWF movie
          TimSymons Level 1
          When you are going to load a movie into another movie you should avoid using the _root keyword. Because the paths may change as they have for your movie.

          In your setProperty() methods, you have:

          setProperty (_root.menuclip.back1, _x, Number(backx)+Number(backmovex));

          But when you load intot another movie clip the path will change to something like this (this assumes that mov_06 is on the _root timeline):

          setProperty (_root.mov_06.menuclip.back1, _x, Number(backx)+Number(backmovex));

          Also, you should look into using the MovieClip._lockroot property (check the help files). It will help with your issue.

          Tim