Solved

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

Posted on 2003-10-31
1
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
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,…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

739 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