Flash Development on PSP

After updating my PSP to the new 2.7 firmware I started to put together some work to use the new Flash Player for the PSP I thought I would post some of my findings to date. As I continue to develop more PSP centric flash content I will continue to post more information as I discover it.

So far I have only produced a single movie suitable, or rather, targeted for the PSP version of the flash player. It has been developed using ActionScript 2 and mtasc to compile the swf. Where possible I have tried to use the Macromedia Class Framework, although in some cases this hasn’t been possible due to issues compiling in mtasc. The two most obvious class issues I have come across have been the with the MovieClipLoader class, and the Delegate class. MovieClipLoader seems not to compile to flash 6/mx compatible swf’s and Delegate was causing mtasc to throw errors. As a result of this I have substituted the MovieClipLoader with the open source MovieCLipLoader6 class from osflash and Delegate has been replace with Delegate from Steve Webster.

In addition I have found the Macromedia Tween classes cause mtasc to throw warnings due to the use of #include statements. But this does not seem to affect compilation.

The PSP display is in a wide screen format, which is of course is a different width height ratio to most standard monitors. With this in mind some consideration needs to be giving to the layout onscreen. Movies should be compatible with the PSP’s screen resolution pf 480 pixels by 272 pixels. In my development I opted to produce a movie that would dynamically resize based on the size of the Stage.width and Stage.height properties. This allows me to produce content to both the PSP flash player, standard monitor resolutions and also as an added bonus the movie should make best use of the growing number of wide screen format monitors available.

The PSP only has limited browser caching, from what I can gather the browser cannot have more than 2048 kB (This page has reference to that figure) of data held with in the 3 ‘tabs’ although JD suggests on his page that it is less than that.

There’s about 1.5 megabytes of RAM available for viewing content on this device

Whatever the actual figure is, it’s nowhere near the amount of memory that we have become use to in modern computing. With these memory considerations in mind I wanted to provide ‘smaller’ content for the ‘PSP Flash’ than the ‘non PSP flash’ presentation. As mentioned in my earlier post this would be done using the System.capabilities.version property of the player.

The PSP flash player returns the following version information;

Player version = NF3 6,0,72,27

Based on this information not only have I been able to load a lower quality and smaller image if a user is using a flash enabled PSP but also the movie only loads a single image rather than 2 separate images (the image is in fact the same image loaded twice, but the principle still holds).

Another important factor is the size of the flash movie ‘in memory’ on the PSP flash player. After compiling my action script classes into an swf with mtasc I was left with a SWF that was reported as 4.96k in size. However this movie is compressed, now I believe this does not truly represent the actual size of the movie in the PSP browser memory. In order to find this out you should check the size of the file uncompressed. In the flash IDE this is simply a matter of un-checking the ‘compress movie’ box in the publishing settings. I couldn’t find a way to do a similar operation with mtasc, so instead made use of flasm using the -x option to decompress the SWF. The result was a movie that was closer to 13k in size.

This gave me a guide to the actual size of the movie, but it still doesn’t really represent the ‘running cost’ of the movie. Obviously as the movie runs, movie clips, variables and new objects will be created and loaded. These will all add to the overall memory ‘cost’ of the flash movie in memory.

To get an idea of this ‘memory cost over time’ I simply opened the movie in the flash player on my PC, opened task manager and looked at the memory usage for the flash player (on a windows machine the stand alone flash player is listed as ‘SAFlashPlayer.exe’).

Task manager reported memory usage of 13,672k. However i figured some of that was the actual running cost of the player application, not just my movie. Running just the Flash 8 player with no content Task manager reported 7,004k so my movie once loaded appears to take about 6k of memory in running cost (13 – 7). I would assume once on the PSP this running cost is in addition to the swf file size, the file sizes of the loaded image, and also the loaded XML document.

Now at this point I should point out these memory calculations are all hypothetical. It would be nice to get some formal documentation for development on the new PSP Flash player, and also information regarding the management of memory or profiling of memory cost of a given swf.

As I go forward with this project the main assumption I intend to make is that with the PSP flash player being based on flash player 6 the memory management and garbage collection will be as poor as that player, and unlikely to be up to the level of the new flash player 8. As a result I will need to do that garbage collection manually to ensure users don’t see the ‘Out of memory’ message. In addition all content will have a ‘Lite’ version specifically for the PSP flash player, for the same reason.

Usefull PSP Flash Development Links

PSP Flash Player info
JD’s Viewing Flash on PSP
PSP browser usage information

Tools Used in this development

Flasm – http://flasm.sourceforge.net/
mtasc – www.mtasc.org/

To test flash locally on your PSP

  1. Create a folder on the root of yout MemoryStick.
  2. Put your development files into the new folder.
  3. Open the browser on your PSP
  4. Hit Triangle and navigate to the address entry and enter URL like the following

(‘file:/’ can be found on the http:// button at the bottom of the list)

**In local testing I have experienced unexpected results in my loading class although this may be an isolated event in my development.

2 thoughts on “Flash Development on PSP”

Leave a Reply

Your email address will not be published. Required fields are marked *