<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:framework="com.esri.aws.osgi.framework.*"
xmlns:services="com.esri.aws.services.*"
layout="absolute"
>
<mx:Script>
<![CDATA[
import com.esri.aws.services.FindOptions;
import com.esri.aws.services.FindResultSet;
import com.esri.aws.services.GeocodeInfo;
import mx.controls.Alert;
import mx.collections.ItemResponder;
import com.esri.aws.services.IFind;
import flash.utils.getQualifiedClassName;
import com.esri.aws.osgi.framework.IServiceReference;
import com.esri.aws.osgi.framework.IBundleContext;
private function doFind() : void
{
var context : IBundleContext = framework.systemContext;
var ref : IServiceReference = context.getServiceReference(getQualifiedClassName(IFind));
if( ref == null)
{
Alert.show( "No service reference !");
return;
}
var find : IFind = context.getService( ref ) as IFind;
find.findLocation( textInput.text, null, new ItemResponder(
function( data : Object, token : Object = null) : void
{
var findResultSet : FindResultSet = FindResultSet(data);
arrayCollection = new ArrayCollection( findResultSet.findResults );
},
function( info : Object, token : Object = null) : void
{
Alert.show( info.toString());
}
));
}
]]>
</mx:Script>
<framework:Framework id="framework"
apiKey="XXXXX">
<services:FindActivator/>
</framework:Framework>
<mx:ArrayCollection id="arrayCollection"/>
<mx:Panel width="100%" height="100%">
<mx:DataGrid width="100%" height="100%" dataProvider="{arrayCollection}"/>
<mx:ControlBar>
<mx:TextInput id="textInput" enter="doFind()"/>
</mx:ControlBar>
</mx:Panel>
</mx:Application>
Thursday, October 25, 2007
How to find locations ?
So...if you want to find "380 new york st, redlands, ca" or "www.esri.com" or "909 793 285", you can use the IFind service.
Mansour
ReplyDeleteI got error like FindResultSet not found. With code hinting I couldn't find the following package
import com.esri.aws.services.FindResultSet;
Is this part of awx-2.0-beta3.swc file? Please help
Sorry about this - this will be available in the 2.0 release (next week :-)
ReplyDelete