Hey all,
I just updated to CS6 last week and tried to run one of my applications that worked fine in 5.5.
I'm now getting an error when I try to compile it. The error is 'Call to a possibly undefined method encode through a reference with static type Class'.
The error coming from this line:
var myJson:String = JSON.encode(myData);
Importing the package com.adobe.serialization.json.JSON, so everything should be fine?
Is there a new way to encode/decode JSON data in CS6? Is there a fix around, or am I just missing something completely?
Cheers.
if you're publishing for fp 11 or better you will use the native flash JSON class. in that case, you should use the static parse() and stringify() methods.
if you're publishing for less than fp11, you can use mike chambers JSON class (https://github.com/mikechambers/as3corelib) that has static encode() and decode() methods.
if you're publishing for fp11 or better, you are NOT using mike chambers class (even though you may be importing it and have it in your library path). you are trying to use two different classes, both named JSON and the native flash class will be the one used by the compiler, not the one you want.
you only need to re-read my above post. if you want to use fp11, use the parse() and stringify() methods. they work the same as chamber's decode() and encode() methods.
North America
Europe, Middle East and Africa
Asia Pacific