0

所以我最近想出了如何在加载的 swf 中访问 textsnapshot,我这样做

  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 等所有其他功能似乎都“损坏”了。IE:

    // 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 子句中,但在运行时没有出现任何错误。

再次感谢堆垛机伙伴!

4

0 回答 0