3 Replies Latest reply on Mar 24, 2007 9:56 PM by kglad

    Custom Math functions

    321-go
      I going through the book ActionScript Cookbook by O'Reilly, and I can't seem to add a custom math method. Here is a simple example:

      Math.timesTwo = function(num){
      return num*2;
      }

      trace(Math.timesTwo(5));

      I get the following error:

      **Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 4: There is no property with the name 'timesTwo'.
      Math.timesTwo = function(num){

      Can someone tell me what I am doing wrong ?

      Thanks

      John