Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSON in Flex. "Access of undefined property JSON"

I am trying to parse JSON in an Adobe Flex app, using http://www.mikechambers.com/blog/2006/03/28/tutorial-using-json-with-flex-2-and-actionscript-3/'>This Tutorial

Unfortunately, Flex Builder 3 is flagging a "Access of undefined property JSON" error on the line

var arr:Array = (JSON.decode(rawData) as Array);

I don't know what it wants, since I included the import line.

like image 313
Alex Avatar asked Nov 10 '08 21:11

Alex


3 Answers

You need to download, install, and reference the utility library that contains the JSON routines. See http://labs.macromedia.com/wiki/index.php/ActionScript_3:resources:apis:libraries#corelib

Did you do that, and include it in your project?

like image 170
dkretz Avatar answered Oct 13 '22 19:10

dkretz


Here is the new location for corelib: https://github.com/mikechambers/as3corelib (as of Feb. 2011 when I'm writing this)

like image 26
user606916 Avatar answered Oct 13 '22 18:10

user606916


Use the below code

var arr:Array = (com.adobe.serialization.json.JSON.decode(rawData) as Array);

instead of

 var arr:Array = (JSON.decode(rawData) as Array);

Dont forget to import below package import com.adobe.serialization.json.JSON;

its working good for me!

like image 22
Dinesh Avatar answered Oct 13 '22 20:10

Dinesh