Tuesday, November 1, 2011

Programming Challenges: API Documentation

I'm working on a flash-based game using the Flixel library, and a regular part of my process is running into things that aren't working or I don't fully understand. I am going to try to post a problem I ran into and the solution I found for it as I work on this game. I'm working in a Windows program called FlashDevelop (version 3.3).

Today's challenge: Updating Flixel's API Documentation

Somehow FlashDevelop had the wrong documentation for the version of the Flixel library I am using.

Basically, I had an older version of the Flixel library that I had been using until recently. When I started this project, I downloaded the latest version of Flixel. As I worked on my program, I kept getting suggestions for variables and functions that didn't exist any more, or had been renamed. Every time this happened I had to dig through the library files for half an hour just to find the right variable or function for the job.

Today I tried to use the FlxSprite.createGraphic() function, which had been renamed in the latest version. When my game wouldn't compile, I went through several files in the Flixel library trying to find which class had the renamed function in it. After I found it, when I tried typing in createGraphic(), it didn't show up in the suggestion list. Instead, makeGraphic() - the new, correct name for the function - was now showing up in the suggestion list.

What?

Turns out FlashDevelop caches a library's contents when you first use it, but doesn't update that cache unless you open the file(s) that have changed.

Solution: Open the library files.

No comments:

Post a Comment