« On the Goog again... | Main | Google Maps AU + NZ »

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.

Flex 2 and Maps application

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.

Flex 2 beta 3 array collection error

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

TrackBack

TrackBack URL for this entry:
http://www.mariposa.com.au/mt/mt-tb.cgi/248

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.

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

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)