Handling Unsupported Browsers
What happens if the user’s browser doesn’t support the ExternalInterface class? Flash offers an available property with a Boolean value that can be used to check whether the class is available before you execute the code. This is also a good time to display a message, if the users’ browser doesn’t support the class. The following code is used in the sample to handle these situations:
if(ExternalInterface.available) { this.message._visible = false; ExternalInterface.addCallback("highlightItem", this, highlightItem); ExternalInterface.addCallback("addAllItems", this, addAllItems); ExternalInterface.call("onFlashLoaded"); }
This code checks for the availability of the class; if it’s not supported, the code is never executed, and the message that displays the requirements is left visible to inform the user of the issue.