Initialization phase of flash player in browser

Just thought I should share a little experience I had with embedding flash content on webpages.  If you’re application has a dynamic width and height (IE. You are sizing your content based on the size of the embed), you need to listen for Event.RESIZE to initialize your application properly. Here are a couple of implementation issues I’ve had with dynamically resized apps:

  • When you embed with Javascript, the stage size directly after load is 0×0.  IE… stage.stageWidth = 0 until the javascript kicks in and stretches the layout properly.
  • When you are not using javascript to embed flash content, the stage size is implemented properly if the .swf hasn’t been cached by the browser.  I ran into this issue where the flash file would implement the stage properly the first time.  However, when visiting the same flash page again, the stageWidth and stageHeight would start out as 0.

By adding a stage listener to detect resizes, issues of rendering the interface based on stage properties can be avoided.  I should mention that both cases of rendering the page on load and on resize must be implemented to avoid edge cases.

Crossdomain Bitmap Loading

Trying to load a bitmap crossdomain without the correct policy file.  Because of this, I can’t access the bitmapData within the loaded document which makes scaling the photos look horrible.  I’m going to try loading the ByteArray and translating it directly to a bitmap.  However, I’m not sure if this gets around the crossdomain issue.

update:

So…. loading the bitmapData as a byteArray using the netStream class seems to work.  I’m going to do a little load testing to see how fast this method is before proceeding.  Here are some resources:

update:

Although at first glance the previous solution seemed to work, it looks like I am still unable to use bitmapData.draw() on the display object that’s created.  I wrapped the some console logging around each step of the conversion process and it looks like everything goes to crap at: oBitmapData.draw(oSource, oMatrix) where oSource is the loaded file in a Loader class that I have forced a type convertion on.  The struggle continues.

Got my kml file working

Here’s a plot of NY’s counties.  

GIS data and Google Maps

Trying to convert an old .e00 gis file collected from the us census bureau to arcView.  Then from ArcView into a shape format that Google maps can plot.  There is a ton of discovery involved specifically with the types of map projections the census bureau uses.  There might need to be some normalization, but until I plot my data, I won’t know (their data is extremely undocumented).  Anywho…. I’ll be updating my progress.

Links:

-Raw Data:  http://www.census.gov/geo/www/cob/co2000.html

-Tools: http://freegeographytools.com/2007/converting-e00-vector-data-to-shapefiles-a-free-and-fairly-painless-approach

Update: Gave up on the arcView format because of it’s proprietary nature.  Looks like arcview is pretty expensive, so I’m using the ascii formated data set which seems to be a space and line delimited list of coordinates (found here: http://www.census.gov/geo/www/cob/co2000.html).  Here’s the general format:

2      -0.737111200944987E+02       0.447554053271605E+02
-0.740250260000000E+02       0.449800360000000E+02
-0.740274011055598E+02       0.449957651692313E+02
-0.740274011055598E+02       0.449957651692313E+02

END

Looks like the first line is the center point of the shape, where each proceeding line until the “END” represents each point in the polygon.