Flex 2 and Maps (flexiMapper)
I'm starting a map search application that will use Adobe Flex 2 as the interface for our ArcIMS mapping.
My impressions are that Flex 2 is a great product and have been very pleased with the speed of development and the power built into the Flash Player! I've played around a bit with Flex's alpha blending (you can see the results with the vector and raster maps below). Currently, the mapping side of things is just a mock-up at the moment but in time it will use an ArcIMS CFC to access real maps
So far I've got Flex calling a (remote) CFC that searches a SDE database to return a query of land parcel records.

I've run into an issue I hope some Flex (beta 3) gurus can help out with.
The webservice result handling part of the Flex code looks like:
[Bindable]
public var parcelresults:ArrayCollection;
private function resultHandler(event: ResultEvent): void {
parcelresults = event.result;
Alert.show("event.result array results",ObjectUtil.toString(event.result));
Alert.show("parcelResults array results",ObjectUtil.toString(parcelresults));
}
Flex builder (FB) reports the error:
"Implicit coercion of a value with static type Object to a possibly unrelated type mx.collections:ArrayCollection."
changing the offending line to cast to type:
parcelresults = event.result as ArrayCollection;
removes the FB error but the alert boxes show parcelresults as null when event.result displays a valid array.

The only way I have found around this is to change the type of the parcelresults definition to the more generic object and remove the type conversion:
public var parcelresults:Object;
...
parcelresults = event.result;
While this works it seems a little strange that parcelresults is never defined (in code) as its proper type: ArrayCollection.
Any enlightenment appreciated.
Cheers
David
Comments
Hey David, try this (I assume event.result is an Array)
private function resultHandler(event: ResultEvent): void
{
parcelresults = new ArrayCollection(event.result as Array);
}
Dirk.
Posted by: Dirk
|
May 12, 2006 01:22 PM
Cheers Dirk,
I thought event.result was already an ArrayCollection but looking again at the screenshots I posted I can see that it is indeed an array.
With your code loading the result into an ArrayCollection, I've now changed:
"public var parcelresults:Object;"
to:
public var parcelresults:ArrayCollection;
(The datagrid must be able to handle arrays and arraycollections?)
thanks and cheers
David
Posted by: David
|
May 12, 2006 02:55 PM