Skip to main content
Participating Frequently
Feb 23, 2009 2:24 PM UTC
Answered

Problem in using CutOperation

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 is closed to new replies. Start a new post to keep the conversation going.
robin_briggsCorrect answer
Adobe Employee
Feb 23, 2009 4:54 PM UTC
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.

2 replies

robin_briggsCorrect answer
Adobe Employee
Feb 23, 2009 4:54 PM UTC
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.
Translate
Participating Frequently
Feb 24, 2009 5:24 AM UTC
Yes thanks it works, but can you explain what is performed inside the createTextScrap() method, other than the TextScrap instantiation.
Translate