3 Replies Latest reply on Nov 12, 2012 5:30 PM by kglad

    Using variables for AS2 function arguments




      I am trying to create a function in actionscript 2.

      After creating the function, I want to use values stored in variables for the function arguments rather than manually typing static values for the function arguments. And also I want to use the function to assign a new value to the existing variable. Is this possible?


      For example, I have defined variables 'here's a simple function named 'CalculationA'.



      var CoinA:Number = 10;
      var CoinB:Number = 20;
      var CoinC:Number;

      function CalculationA(CoinA, CoinB, CoinC) {


           CoinC = Number(CoinA) + Number(CoinB);





      The above code doesn't really work. No value is assigned to the variable CoinC.


      Can someone please give me a correct AS2 code?


      Thank you,