Paiboon Panusbordee
Paiboon Panusbordee

Reputation: 791

What is "ExternalInterface escapes strings using JSON conventions" in the new flash player 14?

There's an error when I use ExternalInterface as below:

WARNING: For content targeting Flash Player version 14 or higher, ExternalInterface escapes strings using JSON conventions. To maintain compatibility, content published to earlier Flash Player versions continues to use the legacy escaping behavior.

What should I do to prevent the warning to show up and what's "legacy escaping" that I should use instead of "JSON convention"?

Upvotes: 7

Views: 3514

Answers (3)

CQ Bear
CQ Bear

Reputation: 394

This warning appears in the debugger console when strings are sent from a running SWF to JavaScript which contain forbidden characters. This may also affect whether deep linking works as expected.

Both the ExternalInterface and BrowserManager APIs are effected. If using the escape() method alone is not enough to eliminate the warning, try:

escape(str).replace(/\./g, "%2E").replace(/\:/g, "%3A").replace(/\//g, "%2F");

Upvotes: 6

Dave Bleeker
Dave Bleeker

Reputation: 129

The error is caused because of json data not escaped. You can prevent the error simply by escaping it:

ExternalInterface.call(callBackFunction, escape(jsonData));

Hope this helps!

Upvotes: 10

CyanAngel
CyanAngel

Reputation: 1238

In general you should avoid anything with the word "legacy" unless you have a very good reason

Good reasons include but are not limited too:

  1. The effort to convert old code away from the legacy system is not possible within your current business constraints.
  2. The legacy system contains essential features not also provided by the newer system.

The problem with legacy systems is the company/developers have no obligation to continue maintaining it.

This specific error message means that:

  1. If you set your target to Flash Player 14 or higher, it will use escape methods that are JSON compliant.
  2. If that is incompatible with your external code you need to target Flash Player 13 or lower.

"JSON compliance" or "JSON conventions" just means that any characters that are special to JSON will be escaped to prevent potential errors

Upvotes: -4

Related Questions