Hi again, 2 minute slater I figure this out: if you put FirstCaracter = my_snap.hitTestTextNearPos(swf._xmouse, swf._ymouse, 0);
as well as LastCaracter = my_snap.hitTestTextNearPos(swf._xmouse, swf._ymouse, 0); basically use swf._xmouse and swf._ymouse, it is zoom/position independent. I'll release the new source to http://swfviewer.blogspot.com/ as soon as I figure out a better way to select text when you are zoomed in and try to go outside visible area.... probably I'll just scroll if it works 2009/3/30 Cristian Rusu <[email protected]> > Hello Seth, > > Did you figure out anything yet related to this? > > I am work in on the same thing right now, I managed to add selectable text > for not zoomed, not shifted document swf. > > Any thoughts on correction for hittest when document get shifted/zoomed? > > > _______________ > Sincerely > Cristian Rusu > ============== > www.crilance.com > Web Development & Electronic Publishing > Chat: [image: Y! messenger:] crirus74 [image: Skype:] Crirus [image: MSN:] > [email protected] > Contact Me: [image: Linkedin] <http://www.linkedin.com/in/crirus>[image: > Twitter] <http://twitter.com/crirus> > > > 2009/2/19 Goldstein, Seth <[email protected]> > >> >> My fault. The fact that I thought it wasn't working from a swf >> generated from pdf2swf was a red herring. The real problem was the fact >> that the swf I was using was a different aspect ratio than Cristian's >> test swf. The different aspect ratio revealed a bug in my hit testing, >> but the swf from pdf2swf was perfectly fine. My hit test fix was to >> change: >> >> my_snap.hitTestTextNearPos(_xmouse, _ymouse, 0); >> >> to: >> >> my_snap.hitTestTextNearPos(_xmouse - swf._x, _ymouse - swf._y, 0); >> >> This still doesn't fix the hit test while zoomed. That's still an open >> problem for me, so if anyone has any suggestions, love to hear it. >> >> -----Original Message----- >> From: Sam Carr [mailto:[email protected]] >> Sent: Wednesday, February 18, 2009 3:40 PM >> To: Goldstein, Seth; [email protected] >> Subject: RE: RE: [Swftools-common] Selectable Text >> >> Well I believe that text snapshots only work with static textfields. I'm >> not sure about text selection. >> ________________________________________ >> From: [email protected] >> [[email protected]] On Behalf >> Of Goldstein, Seth [[email protected]] >> Sent: 18 February 2009 21:19 >> To: [email protected] >> Subject: RE: RE: [Swftools-common] Selectable Text >> >> I'm not sure if the text fields generated from pdf2swf are static or >> dynamic. I'm assuming static, but not positive. Should it matter? >> >> I read Matthias' post ( >> http://lists.gnu.org/archive/html/swftools-common/2009-01/msg00054.html >> ), quoth: >> >> "> Can this static text fields be generated as selectable? >> >> No. But you can wrap a viewer around it which makes the text >> selectable." >> >> Which I assumed was what I was doing with Cristian's zviewer, but it >> still doesn't appear to work. Is there something I need change with the >> viewer to get it to select the text? >> >> -----Original Message----- >> From: Sam Carr [mailto:[email protected]] >> Sent: Wednesday, February 18, 2009 9:35 AM >> To: Goldstein, Seth >> Subject: RE: RE: [Swftools-common] Selectable Text >> >> Different types of text field: Static vs Dynamic? Just a guess. >> >> >> >> >> softwire >> Sam Carr >> Tel : 020 7485 7500 ext 215 | Fax : 020 7485 7575 >> Web : www.softwire.com | E-mail : [email protected] >> Addr : 325 Highgate Studios, 53-79 Highgate Road, London NW5 1TL >> >> Softwire Technology Limited. Registered in England no. 3824658. >> Registered Office : 13 Station Road, London N3 2SB >> >> -----Original Message----- >> From: [email protected] >> [mailto:swftools-common-bounces+sam.carr<swftools-common-bounces%2Bsam.carr> >> [email protected]] On >> Behalf Of Goldstein, Seth >> Sent: 18 February 2009 15:24 >> To: [email protected] >> Subject: RE: RE: [Swftools-common] Selectable Text >> >> >> I guess I spoke too soon. I have copy & paste working with Cristian's >> included test.swf, so I just assumed it was working. But when I >> actually tried it with a swf that was generated by pdf2swf, it doesn't >> work. I tried running pdf2swf with and without the -f flag thinking it >> might be a font issue, but that didn't help either. So what's different >> between the test.swf and the swf coming from pdf2swf? >> >> -----Original Message----- >> From: Goldstein, Seth >> Sent: Wednesday, February 18, 2009 8:53 AM >> To: [email protected] >> Subject: RE: RE: [Swftools-common] Selectable Text >> >> >> Well, I believe textsnapshot works fine zoomed, it is hitTestTextNearPos >> that is failing me. The hit testing is being thrown off but I'm not >> sure how to properly adjust it to get it to hit right. >> >> I'm sure it's probably a really simple problem, but just struggling >> being an actionscript virgin. >> >> From: justin riggio [mailto:[email protected]] >> Sent: Wednesday, February 18, 2009 8:50 AM >> To: Goldstein, Seth >> Subject: Re: RE: [Swftools-common] Selectable Text >> >> So textsnapshot does not work while zoomed? I have it working with >> search but haen't tested with zoom yet. Let me know what you find. I'll >> do the same >> Thanks, >> Justin >> On Feb 18, 2009 9:45 AM, "Goldstein, Seth" >> <[email protected]> wrote: >> >> >> Well, I was playing around with this, and I got it kinda working. The >> only problem left as far as I can tell is that the character hit >> selection doesn't work while zoomed. Can anyone help me out as to what >> changes are necessary to get it to worked while zoomed? Thanks! >> >> For those that might be interested, so far I've taken 2 steps in >> modifying Cristian Rusu's original code ( http://swfviewer.blogspot.com/ >> ) : >> >> 1) Deleted dragarea and commented out all references to areabutton in >> the actionscript >> >> 2) Added the following actionscript, which is based on >> http://www.swftools.org/flash/textsnapshot.html : >> >> stop(); >> >> //my_snap = cliparea.getTextSnapShot(); >> my_snap.setSelectColor(0xffff00); >> firstChar = -1; >> >> cliparea.onPress = function() { >> firstChar = my_snap.hitTestTextNearPos(_xmouse, _ymouse, 0); >> my_snap.setSelected(0, my_snap.getCount(), false); >> trace("cliparea.onPress = " + my_snap.getSelectedText(true)); >> }; >> >> cliparea.onRelease = function() { >> if (firstChar >= 0) { >> lastChar = my_snap.hitTestTextNearPos(_xmouse, _ymouse, >> 0); >> if (firstChar != lastChar) { >> if (firstChar < lastChar) { >> my_snap.setSelected(firstChar, >> lastChar+1, true); >> } else { >> my_snap.setSelected(lastChar, >> firstChar+1, true); >> } >> } >> >> trace("cliparea.onRelease = " + >> my_snap.getSelectedText(true)); >> firstChar = -1; >> lastChar = -1; >> } >> }; >> >> cliparea.onMouseMove = function() { >> if(firstChar != -1) { >> my_snap.setSelected(0, my_snap.getCount(), false); >> //unselect everything >> >> lastChar = my_snap.hitTestTextNearPos(_xmouse, _ymouse, >> 0); >> if (firstChar < lastChar) { >> my_snap.setSelected(firstChar, lastChar+1, >> true); >> } else if(lastChar >= 0) { >> my_snap.setSelected(lastChar, firstChar+1, >> true); >> } >> >> trace("cliparea.onMouseMove = " + >> my_snap.getSelectedText(true)); >> } >> }; >> -----Original Message----- From: >> [email protected] [m... >> >> >> >> >> >> >> >
