Archive

Posts Tagged ‘AS3’

ExternalInterface Error When Parameters Contain Special Characters

March 11th, 2009 Comments off

I ran into a problem today when using ExternalInterface in and ActionScript 3 project. The issue occurred in both Internet Explorer and Firefox. In the project, I was using ExternalInterface.call() to execute a JavaScript function, and passing a long text string as a parameter. The long text string happened to contain a bunch of new lines and slashes. In both browsers a JavaScript error was generated, and the error was not catch-able by a try…catch block in the Flash application. After some searching I found a blog post on Mike Chamber’s site about a known bug in the Flash plugin. The solution is to use String.replace() to sanitize the string before executing ExternalInterface.call().

stringParameter = stringParameter.replace(/n/g, " ");
stringParameter = stringParameter.replace(/r/g, " ");
stringParameter = stringParameter.replace(/\/g, "\\");

Abstract Classes in ActionScript 3

January 14th, 2008 Comments off

For those of you that like the ability to create abstract classes, zeuslabs has written an interesting hack to mimic the behavior in ActionScript 3 (AS3).

Runtime Enforcement of Abstract Classes in AS3

Categories: Programming Tags: , ,

How to integrate the Kongregate AS3 API into your game at runtime

December 6th, 2007 6 comments

Kongregate as finally released an AS3 version of their API. There are two methods to integrate the API with your game. The first method is to download a component and compile it into your game. The second method is to load the API at runtime.

As easy as it is to integrate with the Kongregate API through their component, I prefer to do as much as I can through ActionScript without using the Flash IDE. Also, if you are a game developer that posts your game to multiple portals with their own APIs, you may want to only include the API for each domain as needed.

Read more…