MutationEvents

Hello

Why don't the work extracted below?

#targetengine follow
var doc = app.documents.add(), followMe, followHim, followEvent, n;
followMe = doc.pages[0].textFrames.add({geometricBounds:["20mm", "20mm", "100mm", "100mm"], fillColor: "Cyan", contents: "Follow Me"});
followHim = doc.pages[0].textFrames.add({geometricBounds:["120mm", "20mm", "200mm", "100mm"], fillColor: "Magenta", contents: "Follow Him"});
function follow () {
    followHim.properties = followMe.properties;
    followHim.geometricBounds[0] += 100;
    followHim.geometricBounds[2] += 100;
    followHim.contents = "I'm following him"
}
followEvent = followMe.addEventListener(MutationEvent.AFTER_ATTRIBUTE_CHANGED, follow);
for (n in followEvent) $.writeln(n + ": " + followEvent[n]);

Trevor

As far as I can tell, only one window, LayoutWindow, StoryWindow, film, Sound, MediaItem, link and Toolbox have an event 'afterAttributeChanged '. Executives of related texts are not!

Tags: InDesign

Similar Questions

Maybe you are looking for