<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();
m_root.installFindActivator();
m_map = m_root.createMap();
m_root.addChild(m_map);
}
catch(ex)
{
alert(ex.message);
}
}
function onResult(result)
{
try
{
var arr = result.getFindResults();
for (var key in arr)
{
var findResult = arr[key];
var point = findResult.getPoint()
m_map.setCenter(point);
m_map.setScale(1000000);
break;
}
}
catch(ex)
{
alert(ex.message);
}
}
function onFault(fault)
{
try
{
alert(fault.getMessage());
}
catch(ex)
{
alert(ex.message);
}
}
function findPlace(place)
{
try
{
var responder = m_root.createResponder(onResult, onFault);
var find = m_root.getFind();
find.findLocation(place, null, responder);
}
catch(ex)
{
alert(ex.message);
}
}
function doFind()
{
findPlace( document.getElementById("placeInput").value);
}
AWXBridge.insertFramework("awx", {apiKey:"7cf5e2b1c266030dad57a03e41474775"});
</script>
</body>
</html>
Monday, February 4, 2008
Calling Find service from AJAX
Here is a sample that shows how to call the Find service from AWXBridge. Try 'Disneyland' (no quotes :-)
Labels:
awxbridge,
findservice
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment