Tag Archives: Flex

Flex Builder and Eclipse 3.5

Here’s a blog post by a frustrated developer who seems to have found out how to set up the Flex Builder plugin with Eclipse 3.5 (I have tried it and it works!).  Thank you, frustrated developer!

http://worldwizards.blogspot.com/2009/08/eclipse-35-and-flex-builder.html

From the post:

(1) Download and install Eclipse 3.5. I used the J2EE install.
(2) Download and run the Flex Builder 3 installer.
(3) Ignore all the warnings that it only supports Eclipse 3.3 and 3.4. Just keep telling it that you know what you are doing and want to install it anyway. It will end with a scary message about failing and suggest you do a manual install from inside of eclipse. Don’t do that!
(4) Here is the magic, when it is done there will be a file in your eclipse/links directory called
com.adobe.flexbuilder.feature.core.link
Open that file in wordpad and you will see it contains one line:

C:/Program Files/Adobe/Flex Builder 3 Plug-in

Edit that line so it looks like this:

path=C:/Program Files/Adobe/Flex Builder 3 Plug-in

Save the file and start eclipse. Voilla!

VN:F [1.9.22_1171]
Rating: 5.0/5 (9 votes cast)
VN:F [1.9.22_1171]
Rating: +4 (from 4 votes)

Google Maps Flex API: Refresh TileLayer without refreshing map

This submission is in response to this gmaps-api-flex feature request. This is a hack that provides functionality like what was requested here.

So you’ve added a custom tile layer to your Google Maps app in Flex, which lets you show all your pretty spatial features. Fantastic! If you want to make this tile layer dynamic, however, you run into a few problems. The Google Maps Flex API caches tiles that it has loaded from a specific Tile Overlay, so if your data changes, the changes won’t be reflected on your map immediately. There have been various hacks that force a refresh of the map, but they don’t completely meet the requirements set in this feature request. The attached code here is a hack that tries to mimic the requested functionality, without refreshing the entire map.

After exploring a little, I saw that one way the Flex API differentiates overlays is by the request URL. If you create an overlay, add it to the map, remove it, create a new overlay with the same URL, and add the new overlay, it will load the tiles from the internal cache. Now, this functionality can be nice if you’re switching between two different overlays, and there haven’t been any changes in the data. For instance, if an app requests tiles from the following URLs in order:

mapserver.php?X=0&Y=0&Z=0&LAYERS=calicounties

mapserver.php?X=0&Y=0&Z=0&LAYERS=oregcounties

it will load both of these layers properly, and cache them both. If you then load the calicounties layer, using the same URL string, it’ll give you back the cached version.

However, if the data has changed, you’d want to reload the entire layer. To do this, I have appended a garbage GET variable to the URL. The requests will now look like:

mapserver.php?X=0&Y=0&Z=0&LAYERS=calicounties&GARBAGE=SDK34K

mapserver.php?X=0&Y=0&Z=0&LAYERS=oregcounties&GARBAGE=SDK34K

Simply change the GARBAGE variable when loading calicounties again and it’ll load from the source.

The included code implements four events that are dispatched to/listened from the map object:

  • TileLayerRefresh
    • Tell the Tile Layer to refresh (do not change the GARBAGE variable)
  • TileLayerReload
    • Tell the Tile Layer to reload (change the GARBAGE variable)
  • TileLayerRefreshed
    • Refresh/Reload completed successfully (all tiles loaded)
    • Implemented by incrementing a counter whenever Loader instances are created, and decrementing the counter whenever they complete/fail.
  • TileLayerRefreshError
    • If any loading errors occurred.

Note: You need to pass the TileLayer both the TileOverlay that holds it and the Map object, so it can handle refreshing and event dispatch by itself.


var tileLayer:MapServerTileLayer = new MapServerTileLayer(map);
var tileLayerOverlay:TileLayerOverlay = new TileLayerOverlay(tileLayer);
tileLayer.setOverlay(tileLayerOverlay);
map.addOverlay(tileLayerOverlay);

For an example on using MapServer/PHP MapScript with Google Maps, go to this blog post.

Attached Files:

VN:F [1.9.22_1171]
Rating: 5.0/5 (3 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 2 votes)