3 Replies Latest reply on Apr 23, 2009 6:53 AM by kglad

    Working script moved - stopped working.

    Desprez10

      I had a button when clicked, it would replace a different moviclip.

      This worked until I made the bulk of the code into a function and moved it to the layer, and then tried to call the function from the previously mentioned button. It generates no errors, but it stopped working.

       

      Hierarchy:

      Layer 1 > U1 > image

       

      Original button script:

      on (release) {
          var theDepth:Number = _parent.U1.image.getDepth();
          _parent.U1.attachMovie("K3E", "image", theDepth);

      }

       

      That worked. Here is what it is now, and doesn't work:

       

      Layer 1, Frame 1:

      function swapImage(imageName) {
          var theDepth:Number = _parent.U1.image.getDepth();
          _parent.U1.attachMovie(imageName, "image", theDepth);

      }

       

      Button script:

      on (release) {
           swapImage("K3E");

      }

       

      What is the problem?