Dynamic text from DB?

Hi there,
i was wondering if there’s a way to connect to a DB like AXS or SQL to display within flashMX some dynamic text that would be in the DB.
Anyone know if it’s possible?

Yeah, It’s not too hard. You’ll have to use some kind of server-side scripting to obtain the stuff from the database… like PHP, or ASP, etc. Since I need some practice, I’ll post how to do it.

Stefan

First, make a PHP or ASP, or some type of file that outputs info from your database in the method:

field=field contents&field2=field contents2

Second, you’ll have to code your AS to retrieve the new variables from your PHP or ASP file.
[AS] //create the new object to hold your variables, I’ll call it dyntext
var dyntext = new loadVars();
//next load the variables from the PHP or ASP, etc, file to your new object
dyntext.load(“http://mydomain.com/myphpfile.php”);
//then, once it’s loaded, we’ll assign a text box with the value from field2 gotten from the PHP file
dyntext.onLoad = function() {
mytextbox.text = dyntext.field2;
}
[/AS]

And that’s it… It can be much more complicated than that, but that’s kinda like the basics. Of course you can load variables from any type of file, as long as it’s in the “&field=field contents&field2=field contents2” from.

Hope that helped

Stefan

Thanks a lot for your quick reply, that really helped :slight_smile:

no problem! I’m new here, but this forum is really helpful, so I might as well be helpful back, right? :slight_smile:
-Stefan

welcome then! :wink: