Help with searchable multimedia database using Flash, ASP and Access?

I am making a 200 word dictionary. I have already created hundreds descriptions and audio buttons in flash that when clicked say the word.
I need to make this dictionary searchable. I need a user to be able to search for a word and when the definition appear the .swf(or) button containing the audio pronunciation also appears. I have a basic understanding of Access and asp and I know how to populate a flash movie with dynamic text from a database.
I do not know how to dynamically load .swf or mp3 files from a database from a search.
In flash how can I query a database and return the words text definition and .swf button with the pronunciation?

Thanks.

light4u

You can’t query a database directly from Flash - you must call an ASP file, which contains the code needed to open your database.

How do you call your asp file? Check for the LoadVars variable type, for the functions called “load” and “sendAndLoad”.

Thanks for the reply but like I said before** I know how to populate a movie with dynamic text from a database using ASP.**
I have a basic understanding of Access and asp and I know how to pass variables from flash to ASP to database, back from database to ASP to flash. But only text variables

I have built the database and can already do a search from flash and pull up the text.

** Problem**
I need more then text to return.

I am wondering if I need to use a
mySound = new Sound();
mySound.loadSound(“music.mp3”,true);

or

loadmovie.

I am just not sure how to poulate an Access database with text and the .swf files and then have them return into flash if I do a search.

In flash how can I query a database and return the words text definition and .swf button with the audio pronunciation?

many thanks!
light4u

As you said, I don’t understand what do you want to do - load an mp3 from a database?

You can’t “load” a mp3 IN or FROM a database, but you can send the filename of a mp3.

Suppose that your table contains two fields : one for the mp3 filename, the other for the description.

You can send to AS the mp3 filename, create a new Sound object and load the mp3, using the name provided from ASP (that you stored in a variable).

Unless being expert, you can only send and receive text information from a db…

You have a good example. Suppose this case :

[AS]
received_var = new LoadVars();

//[your loading procedure here]

mySound = new Sound();
mySound.loadSound(received_var.mp3filename,true);
[/AS]

This is a good way to load dynamically your mp3.

So you are saying that I can use the tables in access to call on mp3 files. Right?

Can I do the same with .swf’s?
I already have all the buttons done with the audio pronunciation. Can I put the .swf’s filename in access and call on that too? If so how would I phrase the actionscript.
Thanks.

Remember that you can only send text or string from a db to AS and not the “content” of a graphic file nor mp3. However, there is one thing that you can send, and it’s the filename.

In your db, you should have at least these two columns :

id | mp3name

for example, you could have a row looking like this :

id = “btnAblaEspagnol”
mp3name = “espagnol.mp3”

Put in the id column a unique identifier - a number, a string, whatever. This value will be assigned to your unique button (see below).

Suppose that in your flash movie, the user has to click on a button (and there is one button for each sound).

Depending on the structure of your file, you could put a variable in your root and put something like this :

[AS]on(Click){
_root.btnpressed = btnAblaEspagnol;
}[/AS]

The variable btnpressed will contain “btnAblaEspagnol”. Now, fill your LoadVars variable with this value :

[AS]infoSending = new LoadVars();
infoReceived = new LoadVars();

infoSending.btn = btnpressed;

infoSending.sendAndLoad(“url.asp”, infoReceived);[/AS]

This will send the value of the button to your ASP file and catch the filename to you will send back (from ASP to AS) in the variable infoReceived.

Now in ASP, fetch the value of the environment variable “btn”. Use it to query your db.

Query your db in order to get the mp3name where id is equal to the value of btn. I don’t know how to do it in ASP, so you’re on your own for that part.

When you have the value of the filename in a variable, shoot it in the output of asp with the function “echo” (or the function available in asp that do the same thing). Something like :

echo “mp3filename=” + var_name_having_mp3name_value;

Adapt this line of code to the standard of the ASP language.

You should now be able to read the filename in the variable :

infoReceived.mp3filename

You now just have to load your mp3 the way that you want. By adding a new column to your db, you could also store the swf filename and query the same way your db.

Hope this help.