Log in

View Full Version : Filtering Data in Flash



ayate
07-28-2008, 04:02 AM
Hi

I've been developing a small application in flash using AS2.0. Generally the application accepts user input for product type and sizes, calculate the costs and display output of those calculated costs. Then I used a php script (running on localhost) to store the calculated costs with other associated info, such as operator name, date of calculation, etc. into a flat text file. So each entry takes a line of calculated data in that text file. I used '&' as delimiter for fields of each record.

Now I need to include a search feature in my application. User will search among the stored data using certain keywords and if matching record[s] are found, then it should retrieve and display on flash application screen.

I'm not sure if flash can handle it internally (i.e. to use loadVariable() to load into flash app and then search text string[s], or should I search that text file using a PHP script. What would make more sense for this case? I've been stuck here for a while since I'm pretty new to AS and PHP.

I appreciate all your advice.

Medyman
07-28-2008, 01:12 PM
Hey Ayate,

Welcome to Dynamic Drive :D.

What you say can be accomplished through AS through loadVars(). But, as you say it might not be the best way to proceed in this case. That operation would be really resource intensive with AS 2.0. If you were using AS 3.0, this might be a different question.

But, I definitely recommend using PHP here. It will give faster results. Depending on how much more complicated your application is going to get, you might consider using something like AMFPHP (http://www.amfphp.org/). But, it doesn't seem like you'll be making that many server-related operations. You might also consider moving over to a database, if that's available to you.

ayate
07-29-2008, 07:28 AM
Thanks Medyman. Yea I think I'll just find a way to search through the text file using a simple php script. Things will be easier that way since I just want to perform the keyword search, and pass my search results back into the flash app, right? If I used a database, I have to change everything from the beginning.

Medyman
07-29-2008, 12:25 PM
If I used a database, I have to change everything from the beginning.

Yes, but it's minimal effort really -- 3 or 4 lines of PHP.