Topic: Need some flash advice!! Pages that link to <a href="https://ozoneasylum.com/backlink?for=24503" title="Pages that link to Topic: Need some flash advice!!" rel="nofollow" >Topic: Need some flash advice!!\

 
Author Thread
NeL_Ly
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Dec 2004

IP logged posted posted 12-26-2004 08:33 Edit Quote

I am new to flash.. in the past i have only use flash for design and animation purposes.. this i have an upcoming project which is to create a game using flash... Could someone tell me the various ways to allow flash connect to a database?? and where find information or help on this??

Thanks..

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

IP logged posted posted 12-28-2004 14:58 Edit Quote

you might want to look into the XML socket object of actionscript.

other than that flash has no database functions out of the box, but there are probably some libraries googling around.

what kind of database connection are you using and are you able to use a scripting language?

Steve
Maniac (V) Inmate

From: Boston, MA, USA
Insane since: Apr 2000

IP logged posted posted 12-28-2004 21:14 Edit Quote

Flash and PHP get along quite agreeably. You might have a PHP script handle the back and forth. Both the LoadVars and XML objects have sendAndLoad methods. You could send a variable or an XML packet to the PHP script which would negotiate with the database. Whatever object you specify as the target of what comes back would "catch" the response.

This is off the top of my head, so it probably wo't work exactly this way, but it gives you an idea of how it works. Let's say you want to send your score to the database, and get back your ranking based on that score. You write a PHP script you call "bridge.php" because it's a bridge between your movie and the database. It's a sort of proxy.

In ActionScript 2 you might write

code:
var senderObj:LoadVars = new LoadVars();
var receiverObj:LoadVars = new LoadVars();
senderObj.score = 100;
senderObj.sendAndLoad("bridge.php", receiverObj, "GET");



So senderObj sends its "score" variable to bridge.php via the GET protocol, and targets receiverObj as the target of what comes back.

What happens in bridge.php is up to you, but that's one strategy for getting data to and from a database with ActionScript. If you are using ActionScript 1 it would be the same, just without the ":LoadVars" bit. And if you expect to get data back formatted in XML, make the receiverObj a new XML object. Works great.



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu