Posts

Showing posts from February, 2008

Placing a label on the map

This examples shows how to place a label on the map. Actually, you can place any UIComponent. But make sure to set the width and height of the component :-) <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:awx="http://www.arcwebservices.com/2007/awx" xmlns:test="com.esri.test.*" layout="absolute" > <test:LabelStyle id="labelStyle"/> <awx:Framework apiKey="19640523"/> <awx:Map createDefaultLayers="false"> <awx:MarkerLayer> <test:LabelMarker geoX="45" geoY="45" style="{labelStyle}"/> </awx:MarkerLayer> </awx:Map> </mx:Application> The LabelStyle places the overlay on the map in pixel coordinates. package com.esri.test { import com.esri.aws.awx.geom.PathType; import com.esri.aws.awx.map.layer...

Sending EMail From Flex App

Check out this mailto: RFC. var urlRequest : URLRequest = new URLRequest( "mailto:?subject=MySubject&body=MyBody"); navigateToURL( urlRequest, "_self" ); Make sure to add the _self target to not open a blank browser window.

Calling Find service from AJAX

Here is a sample that shows how to call the Find service from AWXBridge.  Try 'Disneyland' (no quotes :-) <html> <head> <title>Find Sample</title> <style> body { margin: 0px; } </style> </head> <body> <div id="awx" style="width:100%; height:500px;"> <a href="http://www.adobe.com/go/getflashplayer">Download latest Adobe Flash Player</a> </div> <input id="placeInput" type="text"> <input type="button" value="Find" onclick="doFind()"> <script type="text/javascript" src="http://api.arcwebservices.com/awx/v4/awxbridge-4.0.js"></script> <script language="JavaScript" type="text/javascript"> var m_root; var m_map; function onCreationComplete() { try { m_root = FABridge.awx.root(); ...

Screen cleaner

Check this out - way too funny for the dog lovers out there :-)

AWX and AJAX

I've seen a lot of interest lately in using AWX within an AJAX application. The preferred way is to use the AWXBridge API. This is based on Adobe's FABridge technology, and relies on a set of patterns to "bridge" the JavaScript and ActionScript world. Check out this example to see it in action. Here is a quick primer: A JavaScript root object is created to refer to an embedded Flex application - the FABridge property, in this case 'example', is a reference to the DIV id where the Flex application SWF will reside. var flexApp = FABridge.example.root(); Any ActionScript object with an empty constructor can be created from JavaScript using its full name: var chart = FABridge.example.create("mx.charts.ColumnChart"); An AS object public property can be retrieved from JS using a getter function, where the name of the function is based on the property name prefixed with "get" and the first letter of the property is uppercased: flexApp.getSlid...

Tracking the mouse on the map

This is done by setting the mouseHandler property on a map instance to an implementation of the IMouseHandler interface. The IMouseHandler interface has the classic mouseUp, mouseDown, mouseMove abstract functions. In addition, there are two abstract functions; set map() and cleanup(). The cleanup method is called on any previously set handler before a new mouse handler is set. A map reference is "injected" (a al IoC) onto the mouse handler when it is assigned to the map using the setter function. AWX provided a base implementation (BaseMouseHandler) that has a protected helper function to convert a stage mouse location to a GeoPoint. Another provided implementation, BaseOverlayMouseHandler associates a mouse handler with a map layer. This class can be used to draw overlays on map using the mouse such as redlines and rubberband rectangles. The following implementation enables a user to draw a geodesic circle on the map. You can see it in action here . Select the "Dra...

Reading Local Shapefiles

ESRI shapefiles are fairly ubiquitous. That is why I keep getting requests like this “Hey, I would like to render my local shapefiles on top the AWX map, can I do that ?” And I reply “Sure...but !” - Remember the security sandbox of the flash player; 1 - you can only communicate with the server that hosts the swf, or with a host that has a crossdomain.xml file, and 2 - there is no way that you can access your local disk drive directly - So, let’s turn these two restrictions into assets :-) I’m luck enough to run on a Mac, which comes with Apache Web Server built in. So, if I place a crossdomain.xml file at the base url of my local server, then I can access my local shapefiles. Cool eh ? Next, found this AS3 library that can read the shp and dbf file given a ByteArray instance. Here is a code snippet that I used on a project to overlay the continents shapes on top of the map. private function onCreationComplete( event : FlexEvent ) : void { var urlStream : URLStream = new URLStream(...