Skip to main content
Participating Frequently
February 23, 2009
Answered

Problem in using CutOperation

  • February 23, 2009
  • 1 reply
  • 547 views
Hi,
I'm having problem in using "CutOperation" object directly. When calling EditManager's method "cutTextScrap" then cut operation works but if I create CutOperation and execute it using the EditManager's doOperation() then it throws exception. Can you please point out what am I doing wrong here.

//This code works:
var selState:SelectionState = new SelectionState(textFlow, 5, 10);
var textScrap:TextScrap = em.cutTextScrap(selState);


//This code doesn't work:
var selState:SelectionState = new SelectionState(textFlow, 5, 10);
var textScrap:TextScrap = new TextScrap(textFlow);
var op:CutOperation = new CutOperation(selState, textScrap);
em.doOperation(op);

Thanks,
Ahmed
This topic has been closed for replies.
Correct answer robin_briggs
Try creating the TextScrap using SelectionManager instead:

var textScrap:TextScrap = em.createTextScrap();

Then use that when you create the new CutOperation. I haven't coded the whole thing, but I think that should work.

1 reply

robin_briggsCorrect answer
Adobe Employee
February 23, 2009
Try creating the TextScrap using SelectionManager instead:

var textScrap:TextScrap = em.createTextScrap();

Then use that when you create the new CutOperation. I haven't coded the whole thing, but I think that should work.
Participating Frequently
February 24, 2009
Yes thanks it works, but can you explain what is performed inside the createTextScrap() method, other than the TextScrap instantiation.