I’ve always stored the grid information for my game as a comma delimited string(2,2,2,2,2,2,1,1,2,3,5,1,1,1,1 . . ..) This was because I had to have a reasonably efficient way of passing it into Flash. My only problem was that I used Flash’s String.split method to split this string into an array. Now in Flash 5 it took about 8 seconds (there are about 500 elements in the grid). Even using Branden Hall’s String Function Rewrites it took about 5 seconds. The Flash MX Player, with its optimised code for dealing with strings still took several seconds. It meant that my movie would freeze for the period during which it split the string.
But now, courtesy of the wonder that is flash remoting, I can pass complex data structures into flash, so I decided to let Coldfusion do the job and then just pass the array to Flash. New problem – CFMX doesn’t have an exact duplicate of flash’s String.split. After looking dolefully at the reference for a while, and thinking it would take me a while to replicate this functionality, I looked in Google and, lo and behold, there it was. On cflib.org they have lots of handy functions which you can include in your own files, and this one has saved my bacon. the server call still takes about a second, but my Movie isn’t sitting around waiting for it, it can be doing other stuff.