Select to view content in your preferred language

moving from flex 3 to flex 4: graphic layer vs feature layer

392
1
09-14-2010 10:02 AM
abukhan
New Contributor III
I had a graphic layer in flex 3 .
I used querytask and query (using where clause) and
queryTask.execute( query, new AsyncResponder( onResultGetAA, onFaultGetAA ));
on the successhandler(onResultGetAA), the   featureset.features were added to the graphiclayer.graphicprovider..
Note the layer I am query against is a polygon layer in arcgis rest service

Now in Flex 4, I wanted to use featurelayer instead of graphic layer for following reasons:
1) use mode=snapshot
2) useAMF=true(for arcgis 10 server)

I can use definitionexpression with where clause but I want to add a handler for successful query result where I need to process the featureset.features for other purpose...

My question is will it be better in terms of performance for using the feature layer in this situation?

Second, If I use feature layer, how I can add a handler for successful query result (as was in querytask)?


Thanks..
Tags (2)
0 Kudos
1 Reply
ReneRubalcava
Frequent Contributor II
Using a FeatureLayer the way I think you're intending, you would use the definitionExpression of the FL.
Check this example.
http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=FeatureLayer_Search

Another method, that will work the way you have in your post is to use featureLayer.queryFeatures(), which basically sends its params to a queryTask.execute() inside the Featurelayer.
0 Kudos