2 Replies Latest reply on Nov 18, 2008 8:40 AM by sambrown180

    Flash Calculations / Arrays

    sambrown180
      Hi I am new to flash and I am trying to create a vending machine interface. I have made buttons which are images of the products available. I have a seperate section which I want to add up the cost each time one of the products/buttons are clicked. I have been told to look at arrays but I do not understand how they work or what to put in.
      Could someone please explain what would be needed to calculate the cost and what each individual button would need to contain. Example coding would be much appreciated.

      Thank you for your time.
      Sam
        • 1. Re: Flash Calculations / Arrays
          Ned Murphy Adobe Community Professional & MVP
          I don't kow how arrays come into the picture. Create a variable initially set to 0. Each button's code should add a value to this variable. Below is a rough example since you haven't indicated what version of actionscript you are using.

          var totalCost:Number = 0;

          buuton hander function (){ // don't take this line literally
          totalCost += 1.50; // item costs $1.50
          }

          • 2. Re: Flash Calculations / Arrays
            sambrown180 Level 1
            I am using flash 8 its action script 2/3 i believe.
            This will sound basic but with the total cost should this be a text box/button or what? sorry I am very new to flash.
            what should each button have as script in term of:

            on (release) { .........................................