Archive for the ‘Programming’ Category

Reducing .FLA File Size Using Save and Compact

November 11th, 2009 Comments off

I was working on a project to optimize the file size of a published .SWF file today. I wasn’t able to reduce the size of my file by that much, but at the same time I was removing assets from the Library of the source .FLA file. I noticed that after saving, the file size of the .FLA was not decreasing. I started to doubt my sanity, so I decided to see what Google had to say on the subject.

I found this helpful blog post on the subject.

Basically, when using Ctrl+S to save a file, the Flash IDE does a quick save. This quick save, doesn’t do anything to optimize the size of the .FLA file. However, if you use the File > Save and Compact command, Flash will compact the file for you.

However, be warned that saving in this way will remove the undo history for the file. So any changes you’ve made since you opened the file will not be recoverable.

Categories: Programming Tags:

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 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

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

MochiAds Releases Leaderboards

January 22nd, 2008 Comments off

Mochi Mochi has released a new feature through their MochiAds service called “Leaderboards”. I’m still busy working on my next game, so I probably won’t integrate the new leaderboards into Cubical and Tetrical any time soon, but I eventually will. I’ll also be using them heavily in the new game. The leaderboards are very cool looking and at first glance appear to be very easy to create and use. Documentation can found here.

Categories: Programming Tags:

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…