Try this:

function hltext ( txt )
{
        var mc = _root.text;

        var my_snap:TextSnapshot = mc.getTextSnapshot();
        var start_pos:Number = 0;
        start_pos = my_snap.findText ( start_pos, txt, false );
        while ( start_pos > 0 )
        {
                        trace ( start_pos );

                        my_snap.setSelected( start_pos, start_pos +
txt.length, true );
                        start_pos += txt.length;
                        start_pos = my_snap.findText ( start_pos, txt, false
);

        }

        _root.text_selection = my_snap.getSelectedText(true);
}

HTH.

Nicole

On Thu, Jan 8, 2009 at 10:47 AM, Cristian Rusu <cri...@gmail.com> wrote:

>  Hello
>
> Attached is the Viewer I built based on rfxView with additional features
>
> -Full Screen
> -Remember the view/zoom mode on resize/fullscreen.
> -Page jump(text in a  page number)
> -Swf loaded from server/file not inserverd in viewer
> -Load progress % ...
> -Search box, for now only tells the number of findings
>
> Please help me figure out how to actually display the highlight not working
> with this
>
> function hltext ( txt )
> {
>         var mc = _root.text;
>
>         var my_snap:TextSnapshot = mc.getTextSnapshot();
>         var start_pos:Number = 0;
>         start_pos = my_snap.findText ( start_pos, txt, false );
>         while ( start_pos > 0 )
>         {
>                         trace ( start_pos );
>
>                         my_snap.setSelected( start_pos, start_pos + 
> txt.length, true );
>                         start_pos += txt.length;
>                         start_pos = my_snap.findText ( start_pos, txt, false 
> );
>
>         }
>
> }
>
>
> Thanks!
>
> Sincerely
> Cristian Rusu
> Web Programmer & Electronic publisher
>

Reply via email to