Posted by: Jeff Germain | July 4, 2012

BAO API for Flex and ArcGIS API for Flex 3.0

As of this writing, the latest BAO API for Flex (2.2) is not compatible with ArcGIS API for Flex 3.0. Reports fail with the following runtime error:

ReferenceError: Error #1065: Variable com.esri.ags.utils::JSON is not defined.

Until the BAO API for Flex team releases a new version here is a workaround that has worked for me. Basically, I created the missing JSON class in the required package. Here we are simply forwarding encode/decode requests to the new JSONUtil class.

So, add the following class to your Flex project. NOTE the package! Build your project and run. The BAO API should now use this class without issue. I’ve tested on a limited number of report types so let me know if anyone runs into a case where this doesn’t work.

package com.esri.ags.utils { /** * Stopgap class to enable BAO API for Flex 2.2 to run in ArcGIS API for Flex 3.0 project. * @author jgermain * */ public class JSON extends Object { public function JSON() { super(); } public static function encode(object:Object):String { return JSONUtil.encode(object); } public static function decode(string:String):* { return JSONUtil.decode(string); } } }

 

Enjoy!

Advertisements

Responses

  1. Hey Jeff,

    This is great information, but would you happen to have a compiled version since I have no experienced with flash builder. Any help would be greatly appreciated. Thanks

    Collin

  2. Thanks, Jeff. Doing the opposite – switching JSONUtil for JSON in your code – enabled me to use the 3.0 BA API in my 2.5 viewer app! -Julie


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: