2 Replies Latest reply on May 16, 2006 1:32 PM by NSurveyor

    'with' action failed

    klaasp
      This is the error message I receive when i play my flash movie. "Error: A 'with' action failed because the specified object did not exist." The message appears when I switch from one page to another (frame "p_verpakking") in my movie. Inside this frame is a photo viewer with a scrolling menu bar. The scrolling menu bar has the name "menubar_verpakkingen". inside this mc exists a mc with the name "scrollbar_verpakkingen". One of the layers from the mc "scrollingbar_verpakkingen" has this action attached to it:

      xm = 0;
      //function to set the xpos of the movieclip
      function xpos(bar_length,mul)
      {
      hpos = 0;
      scroll_length = 380;
      incr = bar_length/scroll_length;
      //_x = _xmouse;

      xm = _xmouse;
      if(_xmouse <= 10){xm = 10;}
      if(_xmouse >= 380){xm = 380;}
      scroll_x = hpos - xm;
      scroll_x = scroll_x * mul;
      x_pos = scroll_x * incr;
      x_pos = x_pos + hpos;
      return x_pos;
      }

      this.onEnterFrame = function ()
      {

      // call function xpos
      x_pos = xpos(680,.20);
      with (bar)
      {
      _x += (x_pos - _x)*.4;
      }

      // call function xpos
      x_pos = xpos(400,.75);
      with (menu)
      {
      _x += (x_pos - _x)*.4;
      }

      }

      I think that te problem is in this code "this.onEnterFrame = function ()" . I have tried several things, but it didn't work. For example "this.onEnterFrame = function ()" or "this._parent.onEnterFrame = function ()".

      Can someone help me, please?
        • 1. Re: 'with' action failed
          shyaway Level 1
          there's some freaky things going on with the with statement in Flash.
          it gives error too if you're using with in an external mc.

          my solution? avoid using it.
          • 2. Re: 'with' action failed
            NSurveyor Level 2
            Try adding a trace(bar) and trace(menu) to see if either one is undefined. If so, you might have to change the path.

            By the way, changing which movieclip gets the onEnterFrame (ie adding this.onEnterFrame, this._parent.onEnterFrame) won't affect anything. Usually, when you don't put a 'this', Flash will look from where the code resides. In the above, the code isn't moving, but the onEnterFrame is, so it doesn't make a difference.

            You might want to add trace(this) as well to get the current path, and then you can use perhaps this.bar, or whatever the correct path to it is.