what I'm trying to do is accessing
snapText = scrollPane.source.textSnapshot;
from an external swf. I've tried:
trace("-->: "+scrollPane.source.textSnapshot.getText(0, 1000));
trace("-->: "+myLoader.content.textSnapshot.getText(0, 1000));
trace("-->: "+mc.textSnapshot.getText(0, 1000));
trace("-->: "+mc.getChildAt(0).textSnapshot.getText(0, 1000));
trace("-->: "+mc.getChildByName(myLoader).textSnapshot.getText(0, 1000) );
trace("-->: "+scrollPane.content.textSnapshot.getText(0, 100));
all of which were fruitless. BTW:
mc.getChildAt(0).textSnapshot.getText(0, 1000)
throws the error:
1119: Access of possibly undefined property textSnapshot through a reference with static type flash.display:DisplayObject.
although I know the method is there.
all of the above code is run in the function checkHandler:
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, checkHandler);
so the swf should have been completly loaded. The text is also there, I've checked with an swf decompiler. the movieclip with the loader is created like this
scrollPane = MovieClip(root).scrollPaneOnStage;
myLoader.load(new URLRequest("tmp1.swf"));
mc.addChild(myLoader);
scrollPane.source = mc;
thanks in advance!
UPDATE - still not resolved
I'm now accessing the swf as pointed out by HotN.
function checkHandler(evt:Event):void {
libMC = evt.target.content as MovieClip;
libMC.gotoAndStop(0);
trace(libMC.textSnapshot.getText(0, 100));
snapText = libMC.textSnapshot;
scrollPane.source = mc;
}
This resulted at first in an error, because the loader in an as3 script cant load an as2 movie (ie. AVM1). so I created an AVM2 swf which led to the error: Error #2000: No active security context. As a solution I used a class from http://www.igorcosta.org/?p=231 to load the swf, but still cant access the textSnapshot:
trace(libMC.textSnapshot.getText(0, 100));
doesnt return anything and doesnt throw an error!
BTW: while I could change the format of the swf, I cant really change the file itself since it's automatically generated.