Convert Shapefile in Flash MovieClip

A colleague and I have successfully projected data from ESRI shapefile onto stage in Flash (for a web-based app) using the ShpMap class (

However, now we would like to convert the shapefile directly into a MovieClip that can be stored in a library (and use attributes in .dbf to autoname them). Any idea if this is possible and/or ideas for modifying the source code to achieve this?

1 Solution

You cannot. The library can only store ESRI files as ByteArrays, and the MovieClips (Sprites, to be more precise) are created only at runtime. So your best action would be create an array out of your desired maps as class names in library, a paired array of DBF ByteArray class names, and use each pair instead of your library reference. You will then have to remake ShpMap class to accept readymade ByteArrays as parameters for its constructor, so that it won’t use URLRequests to retrieve the data, but take it as provided. Note though, the loading and parsing of the ByteArray is still asynchronous, so you will still employ Loader.load() method and event listeners.