swftools-common
[Top][All Lists]
Advanced

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

Re: [Swftools-common] textsnapshot behavior on converted swfs


From: Chris Flowers
Subject: Re: [Swftools-common] textsnapshot behavior on converted swfs
Date: Sun, 27 Nov 2005 12:25:40 -0500

----- Original Message -----
From: "Matthias Kramm" <address@hidden>
To: <address@hidden>
Sent: Sunday, November 27, 2005 6:02 AM
Subject: Re: [Swftools-common] textsnapshot behavior on converted swfs


> On Sun, Nov 20, 2005 at 09:20:23PM -0500, Chris Flowers wrote:
> > I then read deeper into the specs and found for the highlight to work
> > it needs each font's metrics. This was resloved in the IDE by placing a
> > dynamic text box on stage and embedding 1 character.
>
> Yes, I agree. It seems to need all pieces of font information there is
> (even the layout information, i.e. ascender, descender, leading).
>
> The latest snapshot should now generate this correctly if called
> with the "-f" option. This was broken before.
> I.e. to create a swf where the text snapshot should work, do:
>
>     pdf2swf -f file.pdf -o file.swf
>

Awsome thanks! I'll give this a shot when I get time.


> > I've attached a sample that shows the TextSnapShot hilighting.
> > Portions are selected in yellow. If you do not see the yellow highlights
> > try a newer player version.
>
> Many thanks for this! This was immensely helpful.
>

You're quite welcome. Glad to help out.

> For the record, here's an swfc version of that file:
>
>     .flash version=6 bbox=1024x768 background=white
>
> .font arial filename=../doc/Arial.ttf
>
> .text line1 font=arial text="bla bla bla bla bla bla bla bla bla"
color=black size=50%
> .text line2 font=arial text="abcdefghijklmnopqrtuvwxyz" color=black
size=50%
> .text line3 font=arial text="The quick brown fox jumps over the lazy dog"
color=black size=50%
>
> .frame 1
>
>     # to test pdf2swf files, replace the following sprite with
>     # .swf MyMC filename="testfile.swf"
>
>     .sprite MyMC
> .put line1 x=0 y=50
> .put line2 x=0 y=100
> .put line3 x=0 y=150
>     .end
>
>     .put MyMC
>
> .frame 2
>
> .frame 3
>
> .frame 4
>     .action:
>     MyMC.gotoAndStop(2);
>     str = MyMC.getTextSnapShot();
>     str.setSelectColor(0xffff00);
>     str.setSelected(4,38,true);
>     str.setSelected(44,58,true);
>     .end
>
> .frame 5
>     .action:
> Stop();
>     .end
>     .end
>
> Anybody interested in extending this script so that text is selectable by
the
> mouse, btw.?
>
> Greetings
>
> Matthias
>

Very nice. It looks like TextSnapShot.hitTestTextNearPos(x,y) could be used
to detect
user mouse location. Then combined with the setSelected function selection
could be pulled off
with not too much difficulty.

Chris






reply via email to

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