Search code examples
actionscriptflashexternalinterface

Why would an swf break when changing its export version from Flash 6 to 7?


I need to make a small modification to an existing Flash library (Fusion Charts Free) written in AS1 with Flash 6 as its publish version. My change uses ExternalInterface, which requires Flash 8, so I opened Publish Settings and changed the version to 8. No other changes were made.

Now the swf loads, but encounters some error part-way through its operation. If I change the publish version back to 6, it works again. Changing it to 7 breaks it. My questions:

  1. Is there a complete list of changes between Flash 6 and 7 that affect existing AS1 code?

  2. Is there any way to get real debugging output from an swf, to determine what has happened? It's frustrating that there doesn't seem to be any sort of log or console whatsoever. I've seen a few solutions that involve using ExternalInterface to log to Firebug or such, but obviously that isn't useful to me, given that my whole problem centers around exporting to Flash 8.


Solution

  • Having completed this project, I'll share my experience. Virtually all incompatibilities fell into three categories, described in this very useful article:

    1. Flash 7 variables names are case-sensitive, so xPos and xpos are now separate variables and can't be used interchangeably. You would never do this anyway, if you were writing good code, but if you're trying to port some third-party code, as I was, this is the #1 problem to look out for.

    2. Undefined variable values have changed. In Flash 6, numbers were initialized to zero and strings were empty. In Flash 7, a number is NaN and a string is undefined.

    3. String boolean equivalents are different. In Flash 6, empty strings, or strings other than "1" evaluate to false. In Flash 7, a string with any contents evaluates to true; only empty strings evaluate to false.