Solved

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

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
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 set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
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.

776 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