Skip to main content
June 7, 2006
Answered

multiple text selection in single text field

done a search but couldn't find anything is it possible: ie

blah blah didy blah blah blah blah blah didy blah blah
blahblah blah didy blah blah blah blah blah didy blah blah blah
This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer
June 10, 2006
Ok this is what I came up with.
flash paper stores the text info as static text here:
myFP.document_mc.pages_mc.page1_mc.rawPage_mc

1) get a TextSnapshot object.
2) TextSnapshot.findText method to return the starting index of search term
3) TextSnapshot.getTextRunInfo on the indexes of the search term to return the corner referance points
4) push onto an array and loop until TextSnapshot.findText returns -1

you can then use the array to draw some loverly rectangles in exactly the right poitions in what ever colour you want.

thanks all

18 replies

2m91_2
Inspiring
June 8, 2006
Sorry for not being clear on that:

I know fFashpaper, I paid for it (in combination with contribute a little less, but I also thought that it should have been part of studio - compared with Acrobat it isn't to expensive though.)

I also do know that you can import the swf's generated somehow into "normal" Flash-apps, but I couldn't find a lot of informatioin on the api you mentioned - so I'm still not enlightened ;-(

The Idea with the styles was actually the first that came to my mind (have done acrobatics with it a while ago), but as far as I recalled it offeres nothing in the way of backgrounds, but I fear I'll have to doublecheck.

regards from the unenlighted ;-)
Translate
June 8, 2006
below is what MMAdobe advise...
the link I put in my last post don't seem to work, but you can search the Adobe page for flashpaper 2 api and you get it (its the one with 8 pages)

have tried loading it by way of LoadMovieClip and Loader classes, but for some reason this slows loading down hugly.
there is also of course a flashpaper 2 forum... maybe I should give that a search
Translate
Correct answer
June 10, 2006
Ok this is what I came up with.
flash paper stores the text info as static text here:
myFP.document_mc.pages_mc.page1_mc.rawPage_mc

1) get a TextSnapshot object.
2) TextSnapshot.findText method to return the starting index of search term
3) TextSnapshot.getTextRunInfo on the indexes of the search term to return the corner referance points
4) push onto an array and loop until TextSnapshot.findText returns -1

you can then use the array to draw some loverly rectangles in exactly the right poitions in what ever colour you want.

thanks all
Translate
Participating Frequently
June 8, 2006
just a thought - what about using styles ....put the text into a string then get indexes of all the keywords and apply a bold or color style?
Translate
2m91_2
Inspiring
June 8, 2006
I havern't given it to moch thought right now, and it would largely depend on publish version, usecases an the visual feedback wanted, but it would most likely be quite trick, and it might even be not to smooth.

It would be something about stoing the positions and highlighnig them again but could come out really tricky as the functionality of textfields is limetid in deed.

Might even turn out hat having a selectable version behind a not selectable identical one would be worth a thought depending und details and considering the fact tha you cant even change thehighlight color of selected text, so nothing really elegant. ;-)
Translate
Inspiring
June 8, 2006
What about placing some colored rectangles with _alpha = 10 or something like that over the search terms? If you can get the position of the text into screen coordinates, it shouldn't be too hard. But I don't know if that's possible (text position to screen position).
Translate
June 8, 2006
right i getcha
mmm involve getTextExtent and............ actually a hell of alot of calculating
ooo ok if I get the extent of all the txt before the hilite... no but Id also need the extent of the text before but on the same line...
blah blah

yep I can see that that is possible, but I'm not sure whether I can commit the dev time to that :}
Translate
June 8, 2006
its to highlight search terms
in this case flashpaper 2 class

If I have to, I can do a hilite next routine, but it would be cleaner for the user just to select all all of them in one go

if the simulation is radically more complex than a the hilite next button (which lets face it is dead simple) it wouldn't realy be worth the extra processing, or time to create it.

ta for your time
Translate
June 8, 2006
I am interested in how you might simulate it thou!!
Translate
Participating Frequently
June 7, 2006
2m is right you could simulate it a few different ways depending on why you need multiple text selection. would it be user initiated or automatic. Is it to point out keywords or to select and copy the words.
Translate
2m91_2
Inspiring
June 7, 2006
You could simulate it thoug...
Translate
June 7, 2006
that's stupid >;{
Translate
Participating Frequently
June 7, 2006
nope
Translate