Friday, July 06, 2007

Flex 2 Object Translation problem

So perhaps someone can shed some light on this problem. I've got an XML file Test.xml

<test>
    <myString>72157600686915164</myString>
</test>
When I use an HTTPService call to grab that XML data, the object that result event returns has the value test.myString equal 72157600686915168 no matter what I do. Everything is the same except the last number is 8. Did I find a bug or is the object translation assuming my string is a number and doing some weird operation on it. To make problems even worse... if I have an AS3 object called "someObject" and it's got a property of type String called "someProperty" and then I do:

someObject.someProperty=event.result.test.myString;
Then it becomes 72157600686915170. What the heck is going on!? I tried casting it several different ways... my temporary fix was to add a character to the XML data. In this example an underscore:

<test>
    <myString>72157600686915164_</myString>
</test>
And then I used substr() when I set it to the object property. That worked just fine. For some reason adding a character makes it assume that it's a string, not a number.

0 Comments:

Post a Comment

<< Home

Feed (RSS/Atom)

Contact Me

Don't put anything here: