Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Information from Access to Flash - What's the Easiest Way?

Status
Not open for further replies.

munkygomoo

Programmer
May 16, 2002
15
0
0
US
I have a Microsoft Access database (.mdb) that holds the following fields:
Name . . . . . . Text
Category . . . . Text
Description. . . Text

In my Flash movie, I have 3 dynamic text fields as follows:
txtName
txtCategory
txtDescription

What is the easiest way of getting the information from the database to appear in the text fields in the Flash movie? I tried using a .asp file, but not really knowing what I was doing, I kept getting "Cannot find URL..." errors. Is there some way I can do this without an .asp file?
 
You can do without ASP but you will need some sort of script to act as a "bridge". ASP is a good choice for this, especially with an Access DB but PHP, ColdFusion and CGI will all do the same job.

Regardless of which language you choose to go for you will bring the database values into Flash via a loadVariables() action such as

loadVariables("myScript.asp","");

The variables will be picked up in Flash and can be accessed from the current timeline.

What was the .asp code you were using?
 
I'll get the code for the .asp file when I get home and post it, but I basically copied it from another website and changed it just a little to suit my needs. But seeing as that was the first time I've ever worked with .asp, I really might have screwed it up somehow. What would the .php or the .cgi scripts for it look like?
 
Not a million miles away from the asp script:

a)create connection
b)run SQL query
c)return values
d)close connection

A generic php version:

<?php

$dbh = @mysql_pconnect(&quot;database_server&quot;, &quot;username&quot;, &quot;password&quot;);


if (!$dbh)
{
echo(&quot;<H3>Failed to connect to database server</H3>&quot;);
exit();
}

if (! @mysql_select_db(&quot;db_name&quot;) )
{
echo(&quot;<H3>Failed to find database</H3>&quot;);
exit();
}


$query=&quot;SELECT * FROM table ORDER BY EntryID DESC&quot;;
$result=mysql_query($query);

if ($result == false){
$output= &quot;Can't connect to database&quot;;
}else{
$output=&quot;&variables=&quot;;
while ($row=mysql_fetch_array($result)){
$output.= &quot;Entry:&quot;.$row[&quot;EntryID&quot;].&quot;<BR>&quot;;
}
}

echo $output;

?>
 
Actually forget the above - it's designed to go to an HTML page not Flash, I'm in the middle of a PHP job and just cut and pasted without reading the code.

$output.=&quot;Entry&quot;.$count.&quot;=&quot;.$row[&quot;entryID&quot;];
$count++;

would be more relevant Flash content for the loop.

And the HTML error tags are only really there for testing purposes.
 
What other software / knowledge do I need to get this to work? Do I need mySQL, or anything like that? Or just Access, Flash, and a text editor?
 
Access, Flash and a text editor is all you need... as long as your server has PHP installed. And you'll have to fiddle with the script to actually find your particular DB obviously, the above script is just a general example to give you an idea of how little code you need.
 
munkygomoo,

Do you have a web server running on your pc?

gags
 
no, I just write the files to my hard drive and then upload them into my Tripod homepage - JGD -
 
Server pages like asp or php need to be hosted on specific hosting packages I am not sure it Tripod allow this.

Also if you are going to develop and test on your own pc you will need to run IIS or Apache to get them to work.

Do a bit of research into web servers and hosting.
 
What about CGI? I know that Tripod allows for CGI scripting, so is there an easy way to get the information through a CGI script? - JGD -
 
When I get home today (around 6:00 Eastern Time) I'll upload the .fla and the .mdb files into my Tripod directory and put the links to them here so y'all can help me. 'Cause I'm totally lost here, and I'm just doing it for fun, so I really don't want to be paying for anything more than I have to. - JGD -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top