[webkit-dev] Webkit in AIR - Getting text's coordniates for highlighting

Rehan Abdulaziz abdulazizrehan at gmail.com
Wed Jun 17 03:52:03 PDT 2009


Hey,
I wish to highlight a certain term (e.g. a search query) in HTMLLoader or
HTML (AIR) wherever it appears. The only way to do it in my mind is to
traverse through each component and find the occurrence of the term in its
body. So far, I have written the following code, and do not know where to go
from here:

               private function traverse(win:Object):void {
if (!win) return;
if (!win.document) return;
 trace("doc: " + win.doc);
if (!win.document.body) return;
trace("doc.body: " + win.document.body);
 var idx:int;
if (win.frames) {
for(idx = 0; idx < win.frames.length; idx++) {
 traverse(win.frames[idx]);
}
}
 }

In Firefox, it could be done by using the Find function of an instance
of Components.interfaces.nsIFind. How can I achieve it in AIR?

Thank you
Rehan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090617/9acbdde5/attachment.html>


More information about the webkit-dev mailing list