Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Currency Converter


Anyone out there know where I can find a tutorial or give me any pointers on producing a currency converter which can be updated, with the current euro exchange rate everytime the punter logs on (checks external source), or checks ever hour for people who are on broadband?

Thanx

M@




FlashKit > Flash Help > Flash ActionScript
Posted on: 02-19-2003, 12:09 PM


View Complete Forum Thread with Replies

Sponsored Links:

Currency Converter
Anyone out there know how to make a currency converter in flash5?

View Replies !    View Related
Currency Converter
Here is my last application with Flash. Is a Currency Converter

View Replies !    View Related
Flash Currency Converter [XML]
Hey.
I made a currency converter for Messenger Plus Live (JScript), and I thought I'd port it to flash.

For some reason, it works really well when I'm testing it in flash, but not when I'm running the .swf file, or when its on my webpage.

In my embed/object code, I have allowScriptAccess='always'

And I also have an XML file, like this.

Code:
<?xml version="1.0"?>
<!-- http://bigbob85.insaneparadox.com/cc/crossdomain.xml -->
<cross-domain-policy>
<allow-access-from domain="informer.uzreport.com" />
</cross-domain-policy>
My flash also has this.

Code:
System.security.loadPolicyFile("http://insaneparadox.com/bigbob85/cc/crossdomain.xml");
http://insaneparadox.com/bigbob85/cc/ is the latest version of my Currency Converter.

Im using Flash 8 Pro. I just cant figure out why it works in test, but not online , even though I've included all the other things I have to (that I know of).

Any ideas? Anyone require source?

View Replies !    View Related
Currency Converter - Output NaN
Hi, I was wondering if anyone could look over this and advise me on why the output would be NaN?


Code:
stop();
convertToCNY_btn.onRelease = convertToCNY;


convertToUSD_btn.onRelease = convertToUSD;

function convertToCNY() {
trace("convertToCNY clicked");
var USDtoCNYexchangeRate = Number(7.16);
var USDinput = Number(USDinput_tf.text);
trace(USDinput);
var CNYrate = ( USDinput / USDtoCNYexchangeRate );
trace(CNYrate);
trace(USDtoCNYexchangeRate);
USDconverted_tf.text = CNYrate;
}
I actually have to use xml to get the exchange rate, but I'd figure I'd start off like this to see if it works. Obviously it doesn't, for reasons beyond me, as it always is XD;

View Replies !    View Related
$currency$
How do you round a variable to two decimal places? Or, if it has fewer than two decimal places, stick zeros on the end? (I'm trying to build a "shopping cart"-type thing)

Thanks...

View Replies !    View Related
Currency
Hi

Is there a way of formatting a number into lets say 8.20 instead of 8.2
I cannot find any functions in actionscript at all.

Thanks for any help.

View Replies !    View Related
Formatting Currency
Is there an easy wasy to convert a number to a two-digit decimal place (currency - ie - $7.42). I figured that there is probably a very simple way to do this in Version 5 using the String Object. I just need to convert a number to currency format, or add $.00 at the end if it's a whole number.

Thanks,
mOnkEymAn

View Replies !    View Related
Currency Values ?
This is something I need help with for to projects I'm currently working on. One is a game that counts your score in .01 increments (dollars & cents) and the other is an e-commerce thing. I need to preserve the ending 0 when a total equals .10 or whatever. I also was wonderring (even though I think I know how and will be attempting it right after this post) how can I truncate a decimal value to 2 decimal places, and round up to the nearest .01, like for sales tax.

Thanks for any help.

View Replies !    View Related
How To Display Currency?
Hi folks,

I'm using a dynamic text box to display the total price of some items.
Trouble: when it has only one decimal place (e.g. 6.5) I must add a zero ("0"), so it'd resemble to a kinda price.
I've tried lots of stuff (e.g. %, parseInt, Math.round, ect.)
I,m lost and desperate.
Does anyone know an easy and smart way to get around this problem.

Thanx
ZoMan

View Replies !    View Related
Currency Formatting
how can i convert a normal decimal number into a currency format, or just a format with 2 decimal places?

View Replies !    View Related
Currency/Decimals
I have three different user inputs that are being used with a number of different formulas that offer output dollar amounts to the user. My trouble is, I can not figure out what function I need to use to have the number appear in the outcome box the way I want it to. If the outcome number is supposed to be 47.90, all that is shown is 47.9. I already have the "$" on the stage so I don't need that. If the output number is $0, I would like it to appear as 0.00. I have tried so many different things, I am becoming crazy. Any help/sugguestions much appreciated.

View Replies !    View Related
Variable Into Currency
i have a product catalog that loads variables from a textfile on load and when the product is selected in a listbox the price is shown.....now when the item is added to the cart the shopCart list has the item added with the price set as the data value of that item. i need to be able to keep a running count of the total cost of the items as well as be able to remove the price if items are removed...any ideas...

my initial idea was to simply go

ttlCost = ttlCost + lblItemCost;

then i tried

ttlCost = ttlCost + Number(lblItemCost);

still no good

how can i get the textbox item to be recognized as a number.

thanks all!

View Replies !    View Related
Currency Formatting
Here it is.


Code:
String.prototype.currencyFormat = function() {
isNaN(parseFloat(this)) ? c = 0 : c = parseFloat(this);
v = (Math.round(Number(c) * 100) / 100).toString();
g = v.split(".");
t = g[0].split("");
for (i = t.length - 1; i > -1; i -= 3) {
i != t.length - 1 ? t[i] += "," : null;
}
f = String(Math.round(Math.abs(v) % 1 * 100));
f.length == 1 ? f = ".0" + f : f = "." + f;
return t.join("") + f;
};
//
q = "-1999.999gfhd";
//
trace(q.currencyFormat());
//output: -2,000.00
This is about as simple as I can get it. Currency formatting, and comma insertion.

enjoy

-tutash

View Replies !    View Related
Currency Ticker?
FLASHKIT please help me, do you know where i could find a flash version of a currency ticker? I can't seem to find anything!!

PLEASE HELP!

View Replies !    View Related
Formating Currency
hello all,

I was working on a price formating function. The function takes a 1-5 digit number and returns a price-formated string.

the function is attached bellow. I was trying to use the lastIndexOf() method but couldn't really work it out. can someone help me write a more efficient function.


Code:

var pr:Number = 41300;
function formatPrice(pr):String{

var n:String = pr.toString();
var lastIndex:Number = n.length;
var splitAt:Number = lastIndex-3;
var fortmatedPrice:String;

if(lastIndex>3){
fortmatedPrice = "$" + n.substring(0,splitAt) + "," + n.substring(splitAt, lastIndex);
} else {
fortmatedPrice = "$" + pr;
}

return fortmatedPrice;
}

var formatedPrice = formatPrice(pr);
trace(formatedPrice);

View Replies !    View Related
Format Currency
I am generating random numbers between 1 and 999million

and I would like to format these random numbers into a currency format

e.g 909876543 becomes $909,876,543.00

I have seen a format currency method but I can't get it to work.

Would appreciate it if anyone could help

View Replies !    View Related
Currency, Im Getting My Trailing 0's Cut Off
I have a dynamic text field that gets a value :

value = 2.80

myfield.text = "$" + value;
When it displays it shows up as $2.8.

Is there an easy way to fix this? I saw code to convert to currency but its a lot of code for one little field that will only have this problem 20% of the time... anything easier?

thanks
mcm

View Replies !    View Related
Currency Formatting
Hi,

I'm trying to develop an interactive form which has three boxes to hold figures for total, subtotal (with tax), and monthly payment (total divided by term). I've sorted out the math for this and I'm quite proud of myself for doing so!!(We've all got to start somewhere )

So how can I display the result as formatted currency ie: £14500000 should view as £14,500.00 , $2000000 as £2,000.00
This next needs to happen in 3 separate dynamic text fields.

Why is this so difficult to do in Flash!?

Living in hope but thanks in advance for any help.

mustafalaf

View Replies !    View Related
Currency From String
Hi,

I have a fairly large number in a string (7 characters) but it varies. So what I need is to format it like currency (where commas seperate every third digit

e.g 0,123,456,789

That's all I need.

:-)

View Replies !    View Related
Currency Cure
I have four input boxes that output a calculated total and the final total needs to be displayed as currency. I found the formatAsDollars function which looks like it does exaclty what I'm looking for. Now, how or where do I insert that "total" into the formatAsDollars function to get that result? My syntax savvy is not too good. I saw a lot of comments about the formatAsDollars function but no real clear answer as to how you run your dang variable through there! Not sure how to get it correctly within the Event handler as I've been notified many times. An example would be nice. Anyway, here's the code:

on (release, keyPress "<Enter>") {
total = parseFloat(loads)*parseFloat(barrels)*parseFloat(price)*parseFloat(error)*52;
message = total

function formatAsDollars (amount ):String {

// return a 0 dollar value if amount is not valid
// (you may optionally want to return an empty string)
if (isNaN(amount)) {
return "$0.00";
}

// round the amount to the nearest 100th
amount = Math.round(amount*100)/100;

// convert the number to a string
var amount_str:String = String(amount);

// split the string by the decimal point, separating the
// whole dollar value from the cents. Dollars are in
// amount_array[0], cents in amount_array[1]
var amount_array = amount_str.split(".");

// if there are no cents, add them using "00"
if (amount_array[1] == undefined) {
amount_array[1] = "00";
}

// if the cents are too short, add necessary "0"
if (amount_array[1].length == 1) {
amount_array[1] += "0";
}

// add the dollars portion of the amount to an
// array in sections of 3 to separate with commas
var dollar_array:Array = new Array();
var start:Number;
var end:Number = amount_array[0].length;
while (end > 0) {
start = Math.max(end - 3, 0);
dollar_array.unshift(amount_array[0].slice(start, end));
end = start;
}

// assign dollar value back in amount_array with
// the a comma delimited value from dollar_array
amount_array[0] = dollar_array.join(",");

// finally construct the return string joining
// dollars with cents in amount_array
return ("$" + amount_array.join("."));
}

Thanks for any help

View Replies !    View Related
Currency In DataGrid
Hi,

I've got a datagrid and would like to know if it is possible to have a column formatted with currency.

So, for example I have the values 20, 30, 40 in my "price" column. But I want them to say £20, £30, £40. Problem is I can do that easy,


ActionScript Code:
"£ "+price


But, when calculating totals I need to do this:


ActionScript Code:
Number(quantity)*Number(price)


The £ pound sign messes it up and I get NaN on the totals field. Anyway to get around this? Perhaps I could strip the values after the £ sign and do it that way? Not sure though?

Any ideas guys?

Cheers,
Chris

View Replies !    View Related
How To Convert The Value Into Currency?
Good day!

Can any one help me...how to convert a value into currency format?

here is my code:

Code:
var estimated_counter:Number = Number(price_c.value)* Number(counter_measure.text);

var estimated_backsplash:Number = Number(price_b.value)*Number(backsplash_measure.text);

estimate_price.value = estimated_counter + estimated_backsplash;
this code will output sample:

4000

how to make it that it will out with comma separating values like sample:

4,000

View Replies !    View Related
How Tp Convert The Value Into Currency Value
Good Day!

Can any one help me how to convert a numbers into currency value?

Example i have 1000 it will convert into 1,000

help is greatly appreciated

View Replies !    View Related
Currency Convertor Help
hello
can any help me in this
experiment on currency convertor ( any forigen currency )
ok if its posible in flash
then plz show me how ( what actionscript should be there )
ok i have
2 txt boxes and 1 currency convertor btn
1 txt box is input ( will accepting from user to enter currency )
the second txt box is dynamic which will show the converted to their country currency !
it will only show by clicking on the currency convertor btn !

but how its posible
plz help me in this !
thank you

View Replies !    View Related
Currency In DataGrid
Hi,

I've got a datagrid and would like to know if it is possible to have a column formatted with currency.

So, for example I have the values 20, 30, 40 in my "price" column. But I want them to say £20, £30, £40. Problem is I can do that easy,


ActionScript Code:
"£ "+price


But, when calculating totals I need to do this:


ActionScript Code:
Number(quantity)*Number(price)


The £ pound sign messes it up and I get NaN on the totals field. Anyway to get around this? Perhaps I could strip the values after the £ sign and do it that way? Not sure though?

Any ideas guys?

Cheers,
Chris

View Replies !    View Related
Currency In DataGrid
Hi,

I've got a datagrid and would like to know if it is possible to have a column formatted with currency.

So, for example I have the values 20, 30, 40 in my "price" column. But I want them to say £20, £30, £40. Problem is I can do that easy,


Code:
"£ "+price
But, when calculating totals I need to do this:


Code:
Number(quantity)*Number(price)
The £ pound sign messes it up and I get NaN on the totals field. Anyway to get around this? Perhaps I could strip the values after the £ sign and do it that way? Not sure though?

Any ideas guys?

Cheers,
Chris

View Replies !    View Related
Currency Format On Text
Hey guys and girls,

I was hoping someone could possibly help me out with this problem that I am having.

I am trying to output a number and use currency formating on it. For example:

230 becomes - 230.00
2300 becomes - 2,300.00

Is there a built in way of doing this or can I force it to do this. Please any help would be greatly appreciated.

Thanks
Niklas Wahlberg

View Replies !    View Related
Currency Calculation...success But
i did a currency calculatio prog...that rounds the result to two positions after the decimal points.with help of the funktion posted by johnmac.but it has a problem of not displaying the secong digit after the point if its "0". i found out a solution but still it dosnt work for some numbers entered....pls take a look at the attached file and give me a solution.

View Replies !    View Related
Currency Formatting - Scripting..
if anyones any good at currency formatting in a dynamic text using A-script mail me..cuz i need to get text to go from 0000 to 00.00 or 000 to 0.00 ,,,

Help me please


my email - viktajatt@hotmail.com

View Replies !    View Related
Live Currency Feed
Hi

A client would like a live currency feed in the form of a ticker tape, much like the one found on this site :

http://www.moneycorp.co.uk

Has anyone done anything like this before or have any suggestions where I should start as this is all new to me.

Any help much appreciated

Julian

View Replies !    View Related
Dealing With Numbers And Currency
Hi All

Im having trouble with numbers in flash. I have a series of input text fields, which I have restricted to 0-9 and allowed (.) for decimal place.

BUT this doesn't stop the user entering 12.12.12.12 OR 12.......1 etc, but I need to restrict this to numbers like 12.40, 1034.30, 10.02 etc, any ideas of the best way to do this sort of validation in flash?

View Replies !    View Related
Farmatting A Number As Currency
I am calculating a sale amount for an order form. I want to place that
amount in a text box as follows: $x,xxx but Can't figure out how this is
done. Can anyone help? Thanks in advance.

View Replies !    View Related
Converting Numbers To Currency
I am currently trying to make a financial calculator that will calculate loan payments. However, I am having trouble converting the final product into a currency format.

I have seen that tutorial on Flashkit, but it has to be one of the hardest-to-read tutorials I have ever seen. Has anyone tried this, and if so, do they know a good way to handle this problem? Thanks ahead of time!

View Replies !    View Related
Converting Numbers To Currency
I am currently trying to make a financial calculator that will calculate loan payments. However, I am having trouble converting the final product into a currency format.

I have seen that tutorial on Flashkit, but it has to be one of the hardest-to-read tutorials I have ever seen. Has anyone tried this, and if so, do they know a good way to handle this problem? Thanks ahead of time!

View Replies !    View Related
Format String As Currency
Hi all!

I need a function to format a string to an European currency, ex. "€ 123.456.789,00".

The input can be "123456789" or "123456789.0" (yes dot).

How can I do?

View Replies !    View Related
Currency Formatting Experiment
http://www.des16n.com.br/~jonas/currency.html

Hey folks, please check for bugs.
Hope you enjoy! =)

View Replies !    View Related
How To Format A Number To Look Like Currency
I have a numbers that return say : 5649879

I need this to represent $ format. any idea how to go about this.

thanks
Lance

View Replies !    View Related
Currency In Label Field
I have several fields,

cmbweekly - asks for how many weeks
cmbmonthly - asks for how many months

txttotal - total amount

lblweekly = txttotal/cmbweekly
lblmonthly = txttotal/cmbmonthly

this works fine, but i would like to either round the number or preferbly have it as currency; ie: 12.50

here is my code im using:

Code:

on (release){
   
   Math.round(lblweekly.text = txttotal.text/cmbweeks.value);
   
}

View Replies !    View Related
Turning A Number Ino Currency
Are here any methods available for convertng a Number into a currency type?

Thanks.

View Replies !    View Related
Actionscript Currency Format Function For Ya's
Hey guys,

Just made this simple script to convert any number into USD, check it out here:

http://blog.digidogstudios.com/2005/...-function.html

View Replies !    View Related
Text Field To Currency Format...
This is probably pretty easy, but maybe not. I dunno...

I just want to have it so that a dynamic text field that will be calculating numbers ends up displaying in currency format (XXX,XXX,XXX.XX). Basically, a comma after every third number, and rounding to two decimal places at the end. I don't care about the dollar sign (I'll just concatonate that on the beginning of the number later). Thanks!...

View Replies !    View Related
Limit Decimal Places For Currency?
I'm putting together an e-commerce site in flash and I need to limit the decimal places for currency on the shopping cart and checkout. How would I do this? Also, how would I put in additional zeros if needed? Any help is very appreciated, I can't figure this out for the life of me.
Thanks so much.
Steve

View Replies !    View Related
[MX] Error With Foreign Currency Format
I have an application that displays products with prices on a graphical scale in price order.

There's an array of products with their individual prices that's loaded in from an external ASPX script. I then work out the scale for the display by subtracting the lowest price from the highest price to give me the range. Then the product images are loaded and positioned along the scale according to their prices.

This all works fine for products with prices in dollars or pounds, but I've been asked to make it work for Sweden and thier decimal separator is "," not ".", so 12345.67 in Sweden would be displayed as 12345,67.

When I load in the list of prices, they all contain comas for the decimal separator and as soon as I start to try to do any calculations with them, I get errors in flash because it doesn't know what to do with the comma.

e.g. this returns NaN instead of my lowest price;


Code:
var LowPrice = Math.floor(Number(arrPrice[0]))
I suppose the easiest way around this would be to simply do a string replace of "," with ".", then do the calculations and then reverse the replace before displaying any values back to the screen, but I was wondering if there was any way to get flash to handle the different cultures without having to mess around with the original data?

Thanks,

Richard.

View Replies !    View Related
Simple Calculator Including Currency
I'm new to Flash and I created a simple calculator using a button function.

I need it to output a number as a currency and I'm having trouble doing so including the formatting function.http://kb.adobe.com/selfservice/view...4267&sliceId=2
I'm sure it's a simple fix...

Could someone assist me? Thanks!

View Replies !    View Related
Displaying The Pound Currency Sign
Hi, I am working on a Flash site for a client based in the UK. Its content relies heavily on a backend MySQL database. A php script parses the data, converts it to XML, then passes that on to flash then displays it. There is a problem, however, when it comes to displaying the pound currency (£). The dollar sign ($) shows up but not the former. Can anyone guess where the problem is? I have spent many days on this without any success. Any help is appreciated. Thank you!

View Replies !    View Related
How Can We Do Currency Formatting Depends On Locale
Dear All,
If there is any way to format currency in Flash Action Script... depending on locale ....
Help me .... This is urgent for me .......


Thanks,
Ponnusamy.C

View Replies !    View Related
Currency Text Field & Decimals
Hi all.

I need to add a 0 to a textfield if it look like n.n or n

For example:

1 must be 1.00
1.2 must be 1.20
1.20 must be 1.20

I don't know how to use the String class to do i accept also only a suggestion like "You can do that with the substr command..."

Thx a lot and sorry for my english

View Replies !    View Related
Currency Formatting Problem - Decimal Places :-S
Hey there again people,

Im now stuck with the shopping cart i am producing as the final amount of the products is coming out after calculating a few totals, is not going to 2 decimal places (like currency).

I neede to convert the contents of the variable file " varSurcharge " to currency format 0.00, and I also need it to do it as soon as the flash movie has been loded.

If anyone can help me then please please do. I have searched through the flashkit forum and I have found that all of the solutions either dont work for me or else tutorials they point to, the urls no longer work. It needs to work in Flash 5.

Thanks alot people,

Steven

View Replies !    View Related
Make Flash Games And Earn £££'s (or Whatever Your Currency)
If you can make great flash games, you could earn yourself £1 / €1,4 / $1.6 AUS per download of your game. If you can follow the template for a portable flash gaming device you could earn yourself a small fortune. If you have already made a game for flash 5, you could tweak your game for a 3g handset.

If you are interested goto www.3gflashgames.com or email me on contact@3gflashgames.com

regards

Vinnie

View Replies !    View Related
Currency Symbol (£) Incorrect When Passed To FormMail
I have a site that works fine in Flash. The end result is that on pressing a button it sends an email containing the variables from Flash to the client via a FormMail cgi script.

The problem arises regarding the "£" symbol. It appears correctly in the Flash player but the resulting email has an additional capital "A" with an inverted V above it (like an accented A) in front of all the £ signs.

I've done an extensive search but can't find a way around this problem. Has anyone any ideas.

Egg

View Replies !    View Related
Doing Currency Related Math In Flash, But Last Zero Disappears
HI

Putting together a very simple online form using PayPal to receive and handle payment. Which is working really well btw.

Anyway, in the simple Flash form, I have a text field that constantly updates itself using
onClipEvent (enterFrame) {}

It calculates how much the whole cost will be based upon how many items the customer wants, and their price (before shipping)

The price is $19.95

I searched the forum before and found some code that would allow me to multiply with and spit out numbers that the user can see as currency.

How ever, when you enter quantities like 2, 4 6 etc...
you get results like: 39.9, 79.8, 119.7 etc..

AS you can see, the last zero disappears, probably because the zero = nothing, so Flash doesn't apply importance to it. Although the people I'm making the website for, don't feel the same way.

My question, and problem is...

How do I reattach the zero?


I was thinking that you could just concatenate the zero (subtotal = price + "0") but then you would have an extra and unwanted zero if the user wants 1, 3, 5 etc.. items.
Detecting the number of total digits won't work, unless someone knows how to detect the digits after the decimal point.

I was also thinking that possibly some kind of code like

if quantity requested is divisible by 2 then subtotal = price + "0"
else subtotal = price

would work, but I'm not entirely sure, how to write "quantity requested is divisible by 2"

Anyone have suggestions?

Here is the EXACT code I'm using on the near by movieclip


Code:
onClipEvent (enterFrame) {


//declares cost of item (there is only one)
TotalPrice = "19.95"
//takes the price and makes it usable in multiplication
PriceConvert = Number(TotalPrice);
if (_root.page.form_copies == "") {
_root.HowMany = "0"
} else {
//_root.page.form_copies is the form field the user uses to select how many copies they want
_root.HowMany = _root.page.form_copies


}
totalFigure = _root.HowMany * PriceConvert


// trace("Total Bill: " + totalFigure);







}
Thank you for your time

-Lem

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved