Solved

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

Posted on 2003-10-31
1
174 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
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.

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now