Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-20-2012, 03:16 PM   #1
Eunoshin
Registered User
 
Join Date: Mar 2012
Posts: 22
Default Database recommendations

Morning all! Excuse my ignorance here (this might not even be the right forum to post this), but I need some help.

In my program, I have need of a rather basic database. The database will just be readonly, and will be read at the start of the program and then will not be used again for the duration.

However, I am completely new to implementation of databases, both in general and also to use them with Actionscript. Would any of you be willing to recommend 1) What kind of database to use, 2) The best / simplest way to read databases into Actionscript, and/or 3) Simple guides to help me wrap my head around all the various terminology involved? I see PHP and MySQL tossed around, and I don't know if they're competing technologies, or used at different steps of the process, or WHAT.

Any time you could take out of your busy days would be greatly appreciated.
Eunoshin is offline   Reply With Quote
Old 03-20-2012, 03:46 PM   #2
ASWC
Super Moderator
 
ASWC's Avatar
 
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,528
Default

A web Flash app has no way of reading directly a database like mySQL. That's why it needs the help of a server side script like PHP to read the db (data from the db) and then pass it to the Flash app in a format that Flash can read and understand. This is done simply from Flash by using URLLoader and load a PHP script (you can pass parameters in the URLRequest), that PHP script log into the db, read the data (maybe using the parameters you passed) then print that data using print() or echo() in a format that Flash can understand (XML, value pair, others). When it's done the URLLoader triggers a COMPLETE event. In this COMPLETE event listener you can read what the PHP printed by using simply e.currentTarget.data (contains anything that was printed).
__________________
aswebcreations
Super Duper!
ASWC is offline   Reply With Quote
Old 03-20-2012, 03:59 PM   #3
Barna Biro
Senior Member
 
Barna Biro's Avatar
 
Join Date: Nov 2009
Location: LU, Switzerland
Posts: 1,406
Default

Tiny off topic: I wouldn't say "has no way of reading directly a database", because if I remember seeing some really freaky attempts by some people using sockets ( one 'Java-mix' example: http://www.devx.com/webdev/Article/30638 - might not be the best example but if someone is really interested, then a bit of googling will bring up quite a lot of freaky things ). But indeed, I would never recommend doing something like that

On topic: ASWC summed things up quite well. For your needs, you are most likely more than fine with some XML files ( that you can load directly using the URLLoader class in ActionScript 3.0 and parse the file to extract whatever information you need ). Databases are really useful when you want to also write to them some nice amount of data ( using DB for storing some simple configurations would be quite an overkill )...
__________________
Titus M. Plautus - Not by age but by capacity is wisdom acquired.

Last edited by Barna Biro; 03-20-2012 at 04:05 PM.
Barna Biro is offline   Reply With Quote
Old 03-20-2012, 04:09 PM   #4
ASWC
Super Moderator
 
ASWC's Avatar
 
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,528
Default

Quote:
Originally Posted by Barna Biro View Post
using sockets
Still not what you would call 'direct'. You can see the difference with AIR when you can read a SQLite directly using the SQLite based classes. That's what you'll call 'direct' or 'native', no such thing for web Flash so it's all 'indirect'.
__________________
aswebcreations
Super Duper!
ASWC is offline   Reply With Quote
Old 03-20-2012, 04:25 PM   #5
Barna Biro
Senior Member
 
Barna Biro's Avatar
 
Join Date: Nov 2009
Location: LU, Switzerland
Posts: 1,406
Default

Of course it is not really 'direct' / native since there never was a clear support for such things in AS3 ( maybe never will ). All I was trying to say there have been quite a few 'interesting attempts' to work around such limitantions... As I have already said, I would never recommend such practices in a 'real project'
__________________
Titus M. Plautus - Not by age but by capacity is wisdom acquired.

Last edited by Barna Biro; 03-20-2012 at 04:37 PM.
Barna Biro is offline   Reply With Quote
Old 03-20-2012, 04:29 PM   #6
ASWC
Super Moderator
 
ASWC's Avatar
 
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,528
Default

Quote:
Originally Posted by Barna Biro View Post
there newer was a clear support for such things in AS3 ( maybe never will )
It's not like it's impossible to do, it's just that it would be handling over the key to your db to anyone using your app. That's why front end technology (Flash, Javascript, HTML) will never have direct access to any server side db.
__________________
aswebcreations
Super Duper!
ASWC is offline   Reply With Quote
Old 03-20-2012, 04:31 PM   #7
Barna Biro
Senior Member
 
Barna Biro's Avatar
 
Join Date: Nov 2009
Location: LU, Switzerland
Posts: 1,406
Default

I did not say it is not possible to do and that is why there might never be support for direct DB access... Just that it might never make enough sense to implement such support when there are so many other options at hand.

Edit: Also, as you have already pointed out, before anything like that is to be implemented, a ton of security concerns would need to be resolved... This is a front-end technology and it is of course not likely for it to ever have native support for accesing a DB ( at least not in the current state but who knows what the future holds ).
__________________
Titus M. Plautus - Not by age but by capacity is wisdom acquired.

Last edited by Barna Biro; 03-20-2012 at 04:38 PM.
Barna Biro is offline   Reply With Quote
Old 03-20-2012, 05:52 PM   #8
[afz]snickelfitz
Senior Member
 
[afz]snickelfitz's Avatar
 
Join Date: Dec 2011
Location: Tucson, AZ
Posts: 2,331
Default

OP - what is the purpose/role of the database?
XML is probably a better choice for an external data source, especially if you are new to actionscript and don't actually need a database.
[afz]snickelfitz is offline   Reply With Quote
Old 03-20-2012, 06:12 PM   #9
Eunoshin
Registered User
 
Join Date: Mar 2012
Posts: 22
Default

Snickel: The program is going to read in plain text which is going to be used to dynamically create a number of pictures (loaderObjects) and buttons for the user to interact with. I'm wanting to use a database so that the groups I give the finished program to can alter the DB as needed to update the pictures / button information, without a need for them to interact with the program itself.
Eunoshin is offline   Reply With Quote
Old 03-20-2012, 06:26 PM   #10
Barna Biro
Senior Member
 
Barna Biro's Avatar
 
Join Date: Nov 2009
Location: LU, Switzerland
Posts: 1,406
Default

You can do all the above with simple XML. You do not need a DB for that and "plain text files" instead of XML would be a complete pain to work with.
__________________
Titus M. Plautus - Not by age but by capacity is wisdom acquired.

Last edited by Barna Biro; 03-20-2012 at 07:07 PM.
Barna Biro is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:28 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.