Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Is there a way to build, load, save a database with flash?

Community Beginner ,
Aug 22, 2015 Aug 22, 2015

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.

TOPICS
ActionScript
2.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 22, 2015 Aug 22, 2015

are you creating an air app, projector or web-based app?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 22, 2015 Aug 22, 2015

First I want to build a web based app.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 22, 2015 Aug 22, 2015

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 22, 2015 Aug 22, 2015

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 22, 2015 Aug 22, 2015

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 22, 2015 Aug 22, 2015

I was planning to store names, ID numbers, schedules and grades, ie. student info for approx. 150.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 22, 2015 Aug 22, 2015

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 22, 2015 Aug 22, 2015

Okay, Thank you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 22, 2015 Aug 22, 2015

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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 23, 2015 Aug 23, 2015

he can't use a local sharedobject and a remote one requires a flash media server and that's not going to be easy.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 23, 2015 Aug 23, 2015

>> 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 23, 2015 Aug 23, 2015

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? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 23, 2015 Aug 23, 2015

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 23, 2015 Aug 23, 2015

i never considered he might have one computer used by all the students like a kiosk situation.  (but that seems pretty unlikely.)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 23, 2015 Aug 23, 2015

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.   

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 24, 2015 Aug 24, 2015

if all the data will be entered from your computer, you can use a sharedobject and that's easy to use.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 24, 2015 Aug 24, 2015

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 24, 2015 Aug 24, 2015

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]);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 24, 2015 Aug 24, 2015

Do you need to use flush().  It was mentioned in the example.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 25, 2015 Aug 25, 2015

Yes, everytime you set the data property, use flush() to actually save it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 25, 2015 Aug 25, 2015

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 25, 2015 Aug 25, 2015

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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 25, 2015 Aug 25, 2015

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);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 25, 2015 Aug 25, 2015

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines