Select to view content in your preferred language

Preventing applyEdits() after edition using Editor

839
2
01-29-2013 12:22 AM
ab1
by
Deactivated User
Hi,

I have a feature layer whose geometry is manually edited by the user, using the Editor object.
I'd like to prevent the Editor from calling the applyEdits() method, after a feature geometry is edited by the user.
I want to give to the user the option of applying his edits by clicking on a button.

Is it possible to prevent the Editor from calling applyEdits() method?

Regards.
Tags (2)
0 Kudos
2 Replies
ab1
by
Deactivated User
I found a way to prevent applyedits from being called.
I added to the feature layer a listener on the editsStarting event (a FeatureLayerEvent). When the event is fired, I call the preventDefault() method which prevents applyEdits().
But before that I need to recover all the updates that were performed by the user. So I created a FeatureLayerEvent (named myEvent), pointing on my feature layer, and in which I store all the updates of the fired event:
protected function featureLayer_editsStarting(event:FeatureLayerEvent):void
   {
    for(var i:uint; i<event.updates.length; i++)
    {
     myEvent.updates.push(event.updates);   
    }
    event.preventDefault(); 
   }


Then when the user clicks on the appropriate button, applyEdits method is called:
protected function validerIti_clickHandler():void
   {
    myEvent.featureLayer.applyEdits(null, myEvent.updates, null);
    myEvent.updates = [];
                        }


The problem is that when the user clicks on the button to launch applyEdits, the application crashes and the flash editor with it.
0 Kudos
ionarawilson1
Deactivated User
Hi,

Can you tell me  how to create the myEvent event?

Thank you, this is great!
0 Kudos