Note that there are some explanatory texts on larger screens.

plurals
  1. POfirefox won't convert string to number in flex
    primarykey
    data
    text
    <p>I making a web app in Flex using global coordinates</p> <p>I get the coordinates as strings from a web service then I do something like this:</p> <pre><code>latStr:String = "28.7242100786401"; longStr:String = "-106.12635420984"; var cLat:Number = new Number(latStr); var cLong:Number = new Number(longStr); </code></pre> <p><strong>This works PERFECT on IE and chrome, from the web server and when debugging locally, but <em>Firefox just works when debugging locally</em> and not from the web server, in the web server <code>cLat</code> and <code>cLong</code> return "<code>NaN</code>".</strong></p> <p>check it out yourself, it should pop up an alert when you click on a result: <a href="http://mundobuk.com/prueba/mapa/main.html?buscar=oxxo" rel="nofollow noreferrer">http://mundobuk.com/prueba/mapa/main.html?buscar=oxxo</a></p> <p>so I tried using <code>parseFloat()</code>, but it rounds <code>cLat</code> to <code>28</code> and <code>cLong</code> to <code>-106</code> :(</p> <p>Then I tried separating the decimals form integers, like from my example 28 and 7242100786401 then divide 7242100786401/10000000000000 = 0.7242100786401</p> <p>having 2 numbers 28 and 0.7242100786401 I add them up</p> <p>28 + 0.7242100786401 = 28.7242100786401</p> <p>here is in code form:</p> <pre><code>var latArr:Array = latStr.split("."); var longArr:Array = longStr.split("."); var latDivStr:String = "1"; for (var i:int= 0; i&lt; latArr[1].length; i++){ latDivStr += "0"; } var longDivStr:String = "1"; for (var j:int = 0; j&lt; longArr[1].length; j++){ longDivStr += "0"; } var cLat:Number = parseFloat(latArr[0]) + arseFloat(latArr[1])/parseFloat(latDivStr); var cLong:Number = parseFloat(longArr[0]) - parseFloat(longArr[1])/parseFloat(longDivStr); </code></pre> <p>again, this way works great everywhere, just not in firefox in the web server >_></p> <p>anyone have any ideas? im going crazy whit this @_@</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload