tags:

views:

45

answers:

2

hey guys i have a site entirely built on flash. its basically an e-magazine with lots of textual data. i need to implement a full text search where the user enters search terms in a text field and i need to highlight the occurrence of this search term within the textual contents inside this e-magazine

in a way its similar to what you do within a browser search or pdf search where after typing your search term they highlight all occurrences of this search term within the webpage / pdf document

what is the best way to do this? any ready component / solution / code available? thanks in advance

A: 

Use google - you may fetch google search results from flash, and show inside your flash thing with fancy design.

Doing your own fulltext search will use quite alot of effort - you will need to have indexing too, so if google works for you - use it.

BarsMonster
what i really want is not google search or showing results like how google does... basically i have built an e-magazine in flash and users can simply enter search term (within a textfield within this flash e-magazine) and it should highlight all occurrences of search term within this e-magazine - exactly like how adobe acrobat does when searching for text within a pdf document... can you help... thanks
Raj
+1  A: 

Fixing your accept rate, would already be a good first step :)

It sounds like something you should have envisaged doing before starting your site. You could have created a specific class, or overridden the TextField class, in order to implement a method which given a specific word would look for occurrences of this word in each TextField you want searchable by using the String search() or match() method and apply some formatting to this word in order to highlight it.

This method could be an event listener, although I would rather use the Signal class for something like this. Anyway, here's a basic example

public class SearchableTextField extends Sprite
{
     private var textfield:TextField;

     public function SearchableTextField(dispatcher:EventDispatcher )
     {
          dispatcher.addEventListener( CustomEvent.HIGHTLIGHT , searchEventListener );
     }

     private function searchEventListener( event:CustomEvent ):void
     {
          var searchTerm:String = event.searchTerm;

           if( textfield != null )
           {
               //find every occurrence the searchTerm 
               //in textfield.text and format it
           }

     }
}
PatrickS
hi patrick... +1... are you willing to dig deeper into this and help us with this beyond the limits of stackoverflow for a price? if yes let me know your email n i can explain stuff in greater detail n possibly email you files... thanks a lot so far :-)
Raj
No problem, add me on Skype and send me a message. My Skype name is wopdoowop ;)
PatrickS
thanks mate... will certainly touch base tomm morning from office... im from mumbai india and its 3am here currently... which timezone are you located in and what would be your preferred time of contact in GMT
Raj
I'm based in China so it's GMT + 8.
PatrickS
added u on skype... lets chat asap... thanks for your cooperation
Raj