Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have an ESRI Flex 2.3 FeatureLayer with some graphics in it. I am able to access the graphics geometry and parse the geometry as Esris MapPoint class for Flex Api. I am calling the update(x,y,srs) function..but the change doesnt seem to reflect on the fly unless i zoom in or zoom out. I am trying to make an animation in which the point graphics would move to given locations all at once, but the update() function is not effecting on the run, I called featurelayer.refresh() but that did not help at all. Is there a way to invoke feature layer`s redraw and not refreshing it so that it doesnt request data from service again?

my code..

//movementfeatureLayer is the layer which has point
var features:ArrayCollection=movementfeatureLayer.graphicProvider as ArrayCollection;
for(var i:int=0;i<features.length;i++)
{
var g:Graphic=features.getItemAt(i) as Graphic;
var geomPoint:MapPoint=g.geometry as MapPoint;
var x:Number=geomPoint.x;
var y:Number=geomPoint.y;
(((movementfeatureLayer.graphicProvider as ArrayCollection).getItemAt(i) as Graphic).geometry as MapPoint).update(x+500,y-500,map.spatialReference);
                    }
share|improve this question
    
Are you trying to do actual editing, or do you want to edit the location, just for visual purposes? –  Devdatta Tengshe Aug 9 '11 at 10:34
    
hi, just for visual purpose..but i need to do it while change map location .. and if this works i want to use the spark animate class to animate the object from one location to another. but the update funciton doesnt seem to reflect unless you force redraw by toggling display of layer programmaitcally –  user482963 Aug 10 '11 at 8:44
    
Why not use the esri time enable to animate? –  Brad Nesom Dec 7 '11 at 15:42
add comment

1 Answer 1

Try doing:

movementfeatureLayer.refresh()

share|improve this answer
    
hi,thanks that reloads the whole layer again and requests the server for the features again, whereas i am changing the x,y on the fly and i need to reflect the new position smoothly.. if you toggle the display that works fine but it worked for only one feature in the layer..with more than one features..it simply gets stuck –  user482963 Aug 10 '11 at 8:56
2  
Why not copy the graphics that you want to move into a new local GraphicsLayer and refresh that layer when movement occurs? –  MathiasWestin Aug 10 '11 at 9:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.