How do I display the sum of two Text Inputs on the fly in Flex 3?

Posted on 2009-12-22
Last Modified: 2013-11-11

I can accomplish the following if a button was clicked or if I initiated it with a labelfunction (in a datagrid for example), but I can't figure out how to do this on the fly...

What I am trying to do is that when a user enters a Product Cost in one TextInput and the Taxes in another TextInput, I would like to have a label beneath that calculates the running total as the values are entered in...

Any insight would be greatly appreciated!!!!!!!  Thank you!!!!

<mx:Form width="100%" height="100%"   >

		          <mx:FormItem label="Total Product/Service Cost: $">

		                <mx:TextInput  id="Product_Cost" />


		          <mx:FormItem label="Taxes total: $" >

		                <mx:TextInput id="Taxes" />


		          <mx:FormItem label="Total: $" >

<!--this label obviously doesn't work, but the text is what I am trying to accomplish just in case my question wasn't clear enough.  Once again, THANK YOU!!!!!!!-->		                

<mx:Label id="Total"  text="{Product_Cost.text + Taxes.text}"/>




Open in new window

Question by:stracqan
    LVL 11

    Accepted Solution


    You can typecast the values to number and add.

    <mx:Label id="Total"  text="{Number(Product_Cost.text) + Number(Taxes.text)}"/>

    Open in new window


    Author Closing Comment

    Perfect!!! Thank you!!!

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    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 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.

    728 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

    18 Experts available now in Live!

    Get 1:1 Help Now