[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swftools-common] PDF2SWF and getTextSnapShot()

From: Fabio Rotondo
Subject: Re: [Swftools-common] PDF2SWF and getTextSnapShot()
Date: Wed, 14 Nov 2007 10:38:47 +0100
User-agent: Thunderbird (X11/20071022)

Mark A. Lowe wrote:

Hi Mark,

> > I’m still learning it and the answer may be obvious, but where would I
> > find some documentation/examples on how to search the text once I have
> > loaded my (pdf2swf) .swf file into my Flash application?

this is a common question. You should have had a look to the mailing
list archives before asking  ;-)

that said, here there is my ActionScript code to highlight the text
inside a PDF page. It works with Flash 8 or previous ONLY because the
new Flash 9 has a different AVM interpreter (AVM2) and many things have

Please note:

- ``txt`` is the text to search and highlight inside your page
- ``mc`` points to _root.text that's where I was keeping my swf/pdf page
         you should change that so it references yours.

Here is the code:

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 );


Have fun!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]