 	 */
 	public function ExternalMethod(host:Object, methodInfo:Object)
 	{
+		if (!initialized)
+		{
+			// one-time initialization attempt
+			initialized = true;
+			try
+			{
+				json = getDefinitionByName("JSON");
+				ExternalInterface.addCallback(JSON_CALL, handleJsonCall);
+				WeaveAPI.executeJavaScript(
+					{
+						"JSON_REPLACER": JSON_REPLACER,
+						"JSON_REVIVER": JSON_REVIVER,
+						"NOT_A_NUMBER": NOT_A_NUMBER,
+						"UNDEFINED": UNDEFINED,
+						"INFINITY": INFINITY,
+						"NEGATIVE_INFINITY": NEGATIVE_INFINITY
+					},
+					"weave[JSON_REPLACER] = function(key, value){",
+					"    if (value === undefined)",
+					"        return UNDEFINED;",
+					"    if (typeof value != 'number' || isFinite(value))",
+					"        return value;",
+					"    if (value == Infinity)",
+					"        return INFINITY;",
+					"    if (value == -Infinity)",
+					"        return NEGATIVE_INFINITY;",
+					"    return NOT_A_NUMBER;",
+					"};",
+					"weave[JSON_REVIVER] = function(key, value){",
+					"    if (value === NOT_A_NUMBER)",
+					"        return NaN;",
+					"    if (value === UNDEFINED)",
+					"        return undefined;",
+					"    if (value === INFINITY)",
+					"        return Infinity;",
+					"    if (value === NEGATIVE_INFINITY)",
+					"        return -Infinity;",
+					"    return value;",
+					"};"
+				);
+			}
+			catch (e:Error)
+			{
+				trace(e.getStackTrace() || "Your version of Flash Player does not have native JSON support.");
+			}
+		}
+		
+		// backwards compatibility
 		if (!json)
 		{
-			// one-time external initialization
-			json = getDefinitionByName("JSON");
-			ExternalInterface.addCallback(JSON_CALL, handleJsonCall);
-			WeaveAPI.executeJavaScript(
-				{
-					"JSON_REPLACER": JSON_REPLACER,
-					"JSON_REVIVER": JSON_REVIVER,
-					"NOT_A_NUMBER": NOT_A_NUMBER,
-					"UNDEFINED": UNDEFINED,
-					"INFINITY": INFINITY,
-					"NEGATIVE_INFINITY": NEGATIVE_INFINITY
-				},
-				"weave[JSON_REPLACER] = function(key, value){",
-				"    if (value === undefined)",
-				"        return UNDEFINED;",
-				"    if (typeof value != 'number' || isFinite(value))",
-				"        return value;",
-				"    if (value == Infinity)",
-				"        return INFINITY;",
-				"    if (value == -Infinity)",
-				"        return NEGATIVE_INFINITY;",
-				"    return NOT_A_NUMBER;",
-				"};",
-				"weave[JSON_REVIVER] = function(key, value){",
-				"    if (value === NOT_A_NUMBER)",
-				"        return NaN;",
-				"    if (value === UNDEFINED)",
-				"        return undefined;",
-				"    if (value === INFINITY)",
-				"        return Infinity;",
-				"    if (value === NEGATIVE_INFINITY)",
-				"        return -Infinity;",
-				"    return value;",
-				"};"
-			);
-		}
-		
-		var name:String = methodInfo.name;
-		method = host[name];
+			ExternalInterface.addCallback(methodInfo.name, host[methodInfo.name]);
+			return;
+		}
+		
+		var methodName:String = methodInfo.name;
+		method = host[methodName];
 		// find the number of required parameters
 		paramCount = 0;
 		while (paramCount < method.length && !methodInfo.parameters[paramCount].optional)

import mx.utils.UIDUtil;

import weave.api.WeaveAPI;

internal class ExternalMethod
{
	/**
	 * A pointer to JSON.
	 */
	private static var json:Object;
	
	private static var stringify:Function;
	
	/**
	 * Maps a method name to the corresponding ExternalMethod object.
	 */
	private static const registeredMethods:Object = {};
	
	/**
	 * This is the name of the generic external interface function which uses JSON.stringify().
	 */
	public static const JSON_CALL:String = "_jsonCall";
	

				"JSON_CALL": JSON_CALL,
				"JSON_REPLACER": JSON_REPLACER,
				"JSON_REVIVER": JSON_REVIVER,
				"methodName": methodName,
				"paramCount": paramCount
			},
			"weave[methodName] = function(){",
