Copy link to clipboard
Copied
Is there a way to build, load, save a database with flash? I saw many examples that store one record, and one that made an SQL but it was in AIR and there was a thread about the same thing with it butthe answer then was no.
Copy link to clipboard
Copied
are you creating an air app, projector or web-based app?
Copy link to clipboard
Copied
First I want to build a web based app.
Copy link to clipboard
Copied
you'll need to create the database using your web host controls and you'll need server-side code (eg, php) to connect your swf to your database.
Copy link to clipboard
Copied
Thank you. I'm not quite ready for that how would I do it so the data would be stored locally, such as a projector app.
Copy link to clipboard
Copied
it's more difficult with a projector, but easier with air.
before you go too far though, maybe you can get by with a sharedobject to store data.
what kind of data do you need to store?
Copy link to clipboard
Copied
I was planning to store names, ID numbers, schedules and grades, ie. student info for approx. 150.
Copy link to clipboard
Copied
if you want a database of different users of your app, you'll need to use a web-based database and that's more complicated.
there's no easy solution for what you want.
Copy link to clipboard
Copied
Okay, Thank you.
Copy link to clipboard
Copied
For only 150 users, I think a SharedObject should still be OK, no?
>>it's more difficult with a projector, but easier with air.
WTF is a 'projector'? Ha!
I can target Flash Player or AIR. I remember projector from my Director days, and all that was was an .exe. Which is what AIR is. So I'm not aware of any difference...
Copy link to clipboard
Copied
he can't use a local sharedobject and a remote one requires a flash media server and that's not going to be easy.
Copy link to clipboard
Copied
>> I'm not quite ready for that how would I do it so the data would be stored locally, such as a projector app.
I saw that, and it sounded he could build an .exe instead of .swf.
Copy link to clipboard
Copied
what would he do with the exe?
host it on his own server and have his students connect to his home server?
have the students download the exe and run it on their own computers and use a remote sharedobject?
Copy link to clipboard
Copied
I just commented on what he said. I don't know what he'd do with the exe. But nowhere do I see that he said he was an actual teacher, and maybe he has a central machine available... who knows. I'm always making kiosks where one machine is used by many people, so I guess that comment got me thinking he could do this on one machine. Yeah, if on the web and used by a bunch of students (~150) then a server with the DB on it will be needed.
Copy link to clipboard
Copied
i never considered he might have one computer used by all the students like a kiosk situation. (but that seems pretty unlikely.)
Copy link to clipboard
Copied
Actually, I was a teacher. I just retired. I had the idea of making a program that would have all the pertinent data on a student available to view such as grades, discipline, other grad requirements, that would be on my computer able to access data from a server or directly from my system. not really for students to have access to.
Copy link to clipboard
Copied
if all the data will be entered from your computer, you can use a sharedobject and that's easy to use.
Copy link to clipboard
Copied
I followed the shared object example in the Adobe Action Script Reference Site and it didn't work and know none of my programs will compile. Any Ideas would be helpful. Thank you.
Copy link to clipboard
Copied
to use a local sharedobject, use:
var so:SharedObject=SharedObject.getLocal('student-data','/');
// and that's all that needed to create and retrieve a sharedobject.
// to save data for a student, you can use:
so.data[student_id]={name:studentname,schedule:notsurewhatkindofdatathisis,grade:whatevergrade};
// if you want to retrieve the grade of a student:
trace(so.data[id][grade]);
Copy link to clipboard
Copied
Do you need to use flush(). It was mentioned in the example.
Copy link to clipboard
Copied
Yes, everytime you set the data property, use flush() to actually save it.
Copy link to clipboard
Copied
you actually don't need to use flush, but it's sometimes helpful and i don't see any downside (unless you're using it frequently, eg in a loop).
the data will be written when the swf session ends even without calling flush. but if there's a crash, it's possible the data would not be written to your harddrive unless flush is used.
Copy link to clipboard
Copied
In my experience it's best to just use it everytime you change the data property. There's no downside to calling flush() except, like kglad said, in a loop...
Copy link to clipboard
Copied
Does this in any way effect the read only permissions of the folder, which I cannot change, because I ran the program below and now I am getting an error message " The parameter is incorrect", which I have not seen before, but now none of the programs I have will compile. The program is as follows:
import flash.events.MouseEvent;
import flash.net.SharedObject;var playerName:String;
var mySO:SharedObject=SharedObject.getLocal("myName");
yourNameIs.text = "";confirmButton.addEventListener(MouseEvent.MOUSE_UP,buttonPressed);function buttonPressed(e:MouseEvent):void
{
playerName=playerInput.text;
trace(playerName);
yourNameIs.text="Your Name is "+playerName;
mySO.data.playerName=playerInput.text;
mySO.flush();
trace("Local Data Name: " +mySO.data.playerName);
}
Copy link to clipboard
Copied
use:
import flash.events.MouseEvent;
import flash.net.SharedObject;
var playerName:String;
var mySO:SharedObject=SharedObject.getLocal("myName","/");
yourNameIs.text = "";
confirmButton.addEventListener(MouseEvent.MOUSE_UP,buttonPressed);
function buttonPressed(e:MouseEvent):void
{
playerName=playerInput.text;
trace(playerName);
yourNameIs.text="Your Name is "+playerName;
mySO.data.playerName=playerInput.text;
mySO.flush();
trace("Local Data Name: " +mySO.data.playerName);
}
p.s. format your code so it's legible.