I am using the following code to parse a JSON URL:
var result:Object = com.adobe.serialization.json.JSON.parse(event.result)
But it cannot recognize JSON.parse
, I am using as3corelib.swc (9.3 version).
What is the issue? thanks.
There are two ways to parse JSON in Flex.
One is to use as3corelib. In that case, you need to change your code to
var result:Object = com.adobe.serialization.json.JSON.decode(event.result)
The other way (if you're targeting Flash Player 11+) is to use the built-in JSON class (in the default package):
var result:Object = JSON.parse(event.result)