Hello,
I tried to find the answer on the Internet but haven't found one yet. I am not a Flash coder, but I am learning quickly.
Here's the question: I am trying to highlight a part of the text inside a frame (let say movie clip) and I am not able to make it work 100%.
Here's my code (highlighting):
var my_snap:TextSnapshot = _root._level0.getTextSnapshot();
var count:Number = my_snap.getCount();
my_snap.setSelected(0, 4, true);
var selectedText:String = my_snap.getSelectedText(false);
trace("Text highlighted== > " + selectedText);
This actually works when I on my StaticText box, but when I try to put that code inside a function it finds the strings to be highlighted but it does not highlight the text.
Code with the function (not highlighting):
searchMe.onRelease = function(){
trace("search...");
highlight();
}
function highlight(){
var my_snap:TextSnapshot = _root._level0.getTextSnapshot();
var count:Number = my_snap.getCount();
my_snap.setSelected(0, 4, true);
var selectedText:String = my_snap.getSelectedText(false);
trace("Text highlighted== > " + selectedText);
}
Does anyone knows why it does not highlight when I put the code inside a function?