6 Replies Latest reply on Dec 11, 2010 2:37 PM by Andrei1

# Hi is it possible to make a comma (,) to equal (.) in as3?

Hi is it possible to make a comma (,) to equal (.) in as3?

example:

now i write

2.31 + 4 = 6.31

so it's possible to write

2,31 + 4 = 6,31

• ###### 1. Re: Hi is it possible to make a comma (,) to equal (.) in as3?

you can use the flash string methods to change what the user sees.  but flash will still use standard decimal notation in your coding.

• ###### 2. Re: Hi is it possible to make a comma (,) to equal (.) in as3?

yes thats what i want to do but how do i do that ?

• ###### 3. Re: Hi is it possible to make a comma (,) to equal (.) in as3?

replaceF(yourstring,".",",");

function replaceF(s:String,findS:String:replaceS:String):String{

return s.split(findS).join(replaceS);

}

• ###### 4. Re: Hi is it possible to make a comma (,) to equal (.) in as3?

when i try to implement the code I get the Error 1084: expecting rightparen berfore colon.

num1.restrict = "0-9";

num2.restrict = "0-9";

num3.restrict = "0-9.,";

num4.restrict = "0-9";

num5.restrict = "0-9";

num6.restrict = "0-9";

num7.restrict = "0-9";

num8.restrict = "0-9";

replaceF(num3,".",",");

function replaceF(s:String,findS:String:replaceS:String):String{

return s.split(findS).join(replaceS);

}

• ###### 5. Re: Hi is it possible to make a comma (,) to equal (.) in as3?

that's not an error from my code.  it's from your code.

use:

num1.restrict = "0-9";

num2.restrict = "0-9";

num3.restrict = "0-9";

num4.restrict = "0-9";

num5.restrict = "0-9";

num6.restrict = "0-9";

num7.restrict = "0-9";

num8.restrict = "0-9";

replaceF(num3.text,".",",");

function replaceF(s:String,findS:String:replaceS:String):String{

return s.split(findS).join(replaceS);

}

• ###### 6. Re: Hi is it possible to make a comma (,) to equal (.) in as3?

There is colon where it is supposed to be coma:

Present version: s:String,findS:String:replaceS:String

Should be s:String, findS:String, replaceS:String