所以我最近想出了如何在加载的swf中访问textsnapshot,我喜欢this:
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,checkHandler);
libMC = loader.content as MovieClip;
libMC.textSnapshot.setSelectColor( 0xFFEF00 );
libMC.textSnapshot.setSelected( 100, 200, true );
scrollPane.source = libMC;
ExternalInterface.call("window.alert(\""+libMC.textSnapshot.getText(0, 100)+"\")");
现在,当getText工作并输出实际文本时,所有其他函数(如findText)似乎都“已损坏”。即:
// always returns -1, even though the string clearly exists
libMC.textSnapshot.findText(textPos + searchTI.text.length, searchTI.text, false);
// setselected doesnt seem to have any effect at all
libMC.textSnapshot.setSelectColor( 0xFFEF00 );
libMC.textSnapshot.setSelected( 100, 200, true );
scrollPane.refreshPane();
scrollPane.update();
我把它全部包装到try catch子句中,但是在运行时没有出现错误。
再次感谢其他堆叠器!