tags:

views:

15

answers:

1

I have a class that inherits from EditManager and provides these methods:

public function performCopy():void
{
  var copyOperation:CopyOperation = new CopyOperation( getSelectionState() );
  doOperation( copyOperation );
}


public function performCut():void
{
  var textToCut:TextScrap = TextScrap.createTextScrap( getSelectionState() );
  var cutOperation:CutOperation = new CutOperation( getSelectionState(), textToCut );
  doOperation( cutOperation );
}

PerformCopy works fine and puts the copied text on the clipboard.

PerformCut removes the text as expected but does not put it on the clipboard.

The CutOperation documentation says "The edit manager is responsible for copying the text scrap to the clipboard. Undoing a cut operation does not restore the original clipboard state."

Any idea what I might be doing wrong?

Thanks Stefan

A: 

This does the trick or calling a CopyOperation before:

public function performCut():void
{
 var textToCut:TextScrap = TextScrap.createTextScrap( getSelectionState() );
 TextClipboard.setContents( textToCut );    

 var cutOperation:CutOperation = new CutOperation( getSelectionState(), textToCut );
 doOperation( cutOperation );
}

Just unexpected behavior of CutOperation.

Stefan