5 Replies Latest reply on Jan 3, 2007 5:32 AM by arunbe

    Help with array

    exPluda? Level 1

      I'm having a big problem to make the shoping cart work in my aplication.
      I need something like

      Ref, Quantity, Taxes, Total

      when user choses one product flash should be able to make an array with this values, so user can continue to purchase, and when user finaly presses the order button flash should display all the arrays he previously make.

      does this make sense?

      I've this simple code, but this does not work...

      btn_enc.onRelease = function() {
      array_enc[n++] = {Ref:load_detalhes_produto.ref, Quantidade:_total_.text, IVA:_total_iva.text, Total:valor_total.text};

      any help please?

      thanks a lot,
        • 1. Re: Help with array
          arunbe Level 1
          Hi try out like this....
          You have to create a new object each time when you push into an array....
          • 2. Re: Help with array
            exPluda? Level 1

            Thanks arunbe for reply

            I've tested your code, and tracing it I get [object]

            please look at this piece of code,

            there are 2 buttons in stage, one to continue shoping (btn_enc) and another to purchaise (btn_finalizar)

            When I press the purchaise button, flash says a script in this movie is causin flash to run slowly...

            the goal is to when pressing in the purchaise button flash can be able to nkow exactly what user wants to buy, so I gess I need to have one array per item and then display as many array as it would be necessary

            btn_enc.onRelease = function() {
            num = n++;
            = {Ref:load_detalhes_produto.ref, Quantidade:_total_.text, IVA:_total_iva.text, Total:valor_total.text};
            btn_enc.onRelease = function() {
            var myObj:Object = new Object();
            myObj.Ref = load_detalhes_produto.ref;
            myObj.Quantidade = _total_.text;
            myObj.IVA = _total_iva.text;
            myObj.Total = valor_total.text;
            btn_finalizar.onRelease = function() {
            for (quantos_items=0; quantos_items<=num; quantos_items++) {
            getURL("javascript:alert('"+array_enc[quantos_items].Ref+" "+array_enc[quantos_items].Quantidade+" "+array_enc[quantos_items].IVA+" "+array_enc[quantos_items].Total+"')");
            • 3. Re: Help with array
              arunbe Level 1
              Check out this code...
              • 4. Re: Help with array
                exPluda? Level 1
                Thanks arunbe, your code is easyer than mine and works prety good,

                Going back to work now, thanks!
                • 5. Re: Help with array
                  arunbe Level 1
                  you're welcome.