Profiling Flash CS4 Games

This weekend I’ve been trying to get to the bottom on some performance problems in Fluster. To do so I wanted to use a profiler to see where my game spent it’s time. Unfortunately, for Flash there’s only one profiler and getting it to work can be a nightmare. To save you from the nightmare I’ll run through the steps to get it up and running and how to use it.

Start off by downloading Flex Builder 3. It’s yet another not-free application from Adobe but at least it has a 60-day trail. As an aside, I bought Flash CS4 why do I need to spend an additional $250 to profile my applications? This is why people pirate software, Adobe.

OK, back on topic. If you’ve downloaded Flex Builder and started the install process you may find that it fails to install. This will happen if you’re running Java 1.6 (at least on OS X) the error message says nothing about this, though. So save yourself the trouble and make sure you’re running the right version before booting up the installer.

Once you have installed Flex Builder launch it. What you’ll see is the familiar Eclipse IDE. Start by switching to the “Flex Profiling” perspective by navigating to:

  • Window > Perspective > Flex Profiling

We’re getting there, let’s set up the IDE. For some reason the profiler doesn’t like Firefox so we need to point to a different browser. On OS X I use Safari. To set this open up Flex Builder’s properties and navigate to:

  • Flex > Profiler > Player Browser

Before you can profile your application you need to compile with the debug symbols inside. To do this in Flash CS4 simply go to:

  • Debug > Debug Movie

This will launch your movie in Flash Player with debugging enabled. At this point close Flash Player and boot up your favorite FTP client. Supposedly you can profile local applications, but I have not found this to work. So push the debug build of your game to a server.

Now switch back to Flex Builder and go to:

  • Profile > Profile External Application

With the “Launch Selected Application” button selected, click “New” and enter the URL for your game. Finally, with the right application selected press “Launch” to start the profiler! Once the profiler attaches you should see the following:

Flex Profiler

At this point you should run around in your game to exercise the code paths you’re interested in. Be careful not to close the game yet. As things stand you will have access to data about your game’s memory usage and object instantiation. While these are both useful you probably want performance data. To get this switch back to the IDE and click the “Capture Performance Data” button. Finally, expand your running process and then double click on the “Performance Profile”. After it has compiled and opened you can safely quit your game.

Follow these steps to enable performance data How to capture performance data

Hopefully, with this it’s clear how to profile a Flash CS4 application using Flex Builder 3. Once you get the profiler working its relatively straightforward. If you aren’t sure what do with the data feel free to ask questions in the comments.

Related Posts

2 Comments

  1. Posted April 24, 2009 at 7:03 pm | Permalink

    Thank you a lot! Useful info!

  2. Danyal
    Posted March 11, 2010 at 9:23 am | Permalink

    This blog is good

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>