Solved

Auto change the value of the textField when user click add button

Posted on 2003-10-31
1
178 Views
Last Modified: 2010-04-03
I have another problem now. I have a box that displays the total price and total products in the trolley. I want this box update automatically each time user add a product or edit the quantity of the product. I’ve tried loadVariables from asp and displaying all the information. I put it in the movie clip (the box) using onClipEvent(load). When I test it independently, it works well, but when I combine it my flash. it doesn't works. The problem is when user begins to add product in the trolley, the total price & the total quantity is not updated. The value is always 0. Any idea what should I do?

onClipEvent(load)
{
      //Prices = "5,6,7";
      //quantity = "3,1,2";

      loadVariables("addbuy.asp", "", "POST");
      if (Prices eq "") {
            totalItems = "0";
            subtot = "$ " + "0.00";
      } else {
                                Price_array3 = Prices.split(",");
                                Qty_array3 = quantity.split(",");
                                Price_length3 = Price_array3.length;
                                Qty_length3 = Qty_array3.length;

                                for (i=0;i<Price_length3;i++) {
                                                totItem = totItem + parseInt(Qty_Array3[i]);
                                                totPrice = Price_Array3[i] * Qty_Array3[i];
                                                subtotal = subtotal + totPrice;
                                }
                                totalItems = totItem;
                                subtot = "$ " + subtotal;
      }
}
0
Comment
Question by:Cyber_Cus2
1 Comment
 
LVL 27

Accepted Solution

by:
negatyve earned 500 total points
ID: 9657125
onClipEvent (load) {
      //Prices = "5,6,7";
      //quantity = "3,1,2";
      this.loadVariables("addbuy.asp?q=" + (new Date().getTime()), "POST"); // look here
}
onClipEvent (data) {
      if (Prices eq "") {
            totalItems = "0";
            subtot = "$ " + "0.00";
      } else {
            Price_array3 = Prices.split(",");
            Qty_array3 = quantity.split(",");
            Price_length3 = Price_array3.length;
            Qty_length3 = Qty_array3.length;
            for (i = 0; i < Price_length3; i++) {
                  totItem = totItem + parseInt(Qty_Array3[i]);
                  totPrice = Price_Array3[i] * Qty_Array3[i];
                  subtotal = subtotal + totPrice;
            }
            totalItems = totItem;
            subtot = "$ " + subtotal;
      }
}

and when you need to update data, load again the same page in the movieclip, this way:

movieclip_instance_name.loadVariables("addbuy.asp?q=" + (new Date().getTime()), "POST");

if you are loading again from the movieclip itself, use:

this.loadVariables("addbuy.asp?q=" + (new Date().getTime()), "POST");
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Cannot install Adove Flash player on Windows 2012R2 6 105
black magic design 1 131
Running Mp4 or Flash Video 1 139
Flash ActionScript 6 62
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question