5 Replies Latest reply on Oct 12, 2007 9:41 PM by kglad

    Functions and Returns

    backpages Level 1
      I'm working through a new book on ActionScript 3. They use this example of a function and tracing the value it returns:

      function moveBoarder():Number {
      boarder1_mc.y -= 150;
      boarder1_mc.scaleX = 2;
      boarder1_mc.scaleY = 2;
      return boarder1_mc.y;
      }

      moveBoarder();

      trace(moveBoarder());

      Now, the original value of boarder1_mc.y is 310. Once you run the moveBoarder() function it should be 160. And if you leave the the trace method off it is. They use this example to show how to trace value that the function returns. It should be 160. But when I run this code it is 10 and the mc has been moved up another 150 pixels.

      Any idea what is wrong here? Is the example wrong? Am I doing something wrong?

      Thanks for any help. Thanks!