AS3 Sending a Shared Object - actionscript-3

I'm working on an application that would allow users to create a custom character sheet for role play games. I have most of the code figured out, but I want users to be able to send their character sheets between devices.
So here's the question: is there a way to save and send a shared object file, or a way to create a txt file that can easily be saved and copied?

I don't believe you can send a SharedObject from one device to another, at least without a lot of work. You could however create an XML file containing the data and save that up to a server. You could allow the user to then download character sheets from your server and the app would read the XML data before converting to a SharedObject. Can't really provide any code for this as the details are lacking.

If I understand you correctly, you could sort of do this.
You cannot literally "send and receive" a SharedObject (well, you might be able to copy your shared object data on the file system directly, but not from Flash).
What you can do is provide options to the user to save and load a file that encodes all the shared data in AMF bytes. Here's the general idea:
First you need to give the user an option to save their data. You can use ByteArray/writeObject() to write your data using the same AMF format that SharedObjectuses, and FileReference/save() to allow the user to save it to a file on their file-system.
Next, you can use FileReference/load() to load the file and ByteArray/readObject() to read all the data into AS3. Now you can simply store it in the SharedObject however you want, just like you did before.

Related

Storing and loading data from react-native calendar to a JSON file

I'm currently thinking of a concept for a react-native app where people add events over a period of time like a diary/log. These events need to be exported and for security and privacy reasons I don't want to use a database. I've read you can use JSON files as a storage method, too.
How can I store data from the app to a JSON file and load the data from the JSON file back in the app? Don't need any code, helpful articles or webpages are appreciated
Assuming that you already have all the app data into a json, its rather simple.
Decide where to store the appdata.json, lets call it APP_DATA_PATH
Find a library to read/write files (I've only used expo-file-system)
On app boot, check if APP_DATA_PATH exists, if it does read the file and load into app, if not assume its a new user
Whenever app data changes, write the changes to APP_DATA_PATH

Save html table data locally with electron

I'm new to coding and its a lot of try and error. Now I'm struggling with html tables.
For explanation: I am building an Electron Desktop application for stocks. I am able to input the value via GUI in an html table, and also export this as Excel file. But, every time I reload the app, all data from the table are gone. It would be great to save this data permanently, and simply add new data to the existing table after an application restart.
What's the best way to achieve this?
In my mind, it would the best way to overwrite the existing Excel file with the new work (old and new data from the table), because it would be easy to install the tool on a new PC and simply import the Excel file to have all data there. I don't have access to a web server, so I think a local Excel file would be better than a php solution.
Thank you.
<table class="table" id="tblData" >
<tr>
<th>Teilenummer</th>
<th>Hersteller</th>
<th>Beschreibung</th>
</tr>
</table>
This is the actual table markup.
Your question has two parts, it seems to me.
data representation and manipulation
data persistence
For #1, I'd suggest taking a look at Tabulator, in particular its methods of importing and exporting data. In my projects, I use the JSON format with Tabulator and save the data locally so it persists between sessions.
So for #2, how and where to save the data? Electron has built-in methods for getting the paths to common user directories. See app.getPath(name). Since it sounds like you have just one file to save, which does not need to be directly accessible to the user, appData is probably a good place to store it.
As for the "how" to store it – you can just write a file to that path using Node fs, though I like fs-jetpack too. Tabulator can save data as well.
Another way to store data is with electron-store. It works very well, though I've only used it with small amounts of data.
So the gist is that when your app starts, it loads the data and when the app quits, it saves the data, along with any changes which have been made, though I'd suggest saving after every change.
So, there are lots of options depending on your needs.

Is there any way to fill in Sharepoint entries via parsing text file?

My workplace has a whole bunch of unannotated .zip files that need to be uploaded to the new file server (Windows). I've used perl to parse through through the excel files within the .zip files to create an annotation.txt file for each .zip file that contains information about the .zip file. I have 1000's of zip files and do not want to manually enter in information for each entry if there's a way to automate it. I am proficient in perl and mysql, and wondering if there is any way to utilize my skillsets to port this information into the Microsoft Sharepoint website.
Thank you in advance for any advice or suggestions.
There a many, many ways to meet your requirement.
You could write a event receiver to parse the files once uploaded and set metadata.
A better approach for your use case might be to write a .NET based console application and reference Microsoft.SharePoint.Client and then upload your files using the Client side object model (CSOM) and set the metadata during that process as outlined here: Upload a document to a SharePoint list from Client Side Object Model
There are also REST and ASMX webservices that you could call from a non .NET runtime process.
Plenty of options, pick the one that fits your needs and skills best.

Play local mp3 with HTML5. How could save file reference to create a playlist?

I am trying to write a mp3 player using HTML 5 benefits. Play local file, until now, seems ok. Im writing sample codes based on these example : http://antimatter15.github.com/player/player.html
Here's the thing : I have to get the reference of each mp3 file. I want to get all this reference and save on database for when the client access the website i show this playlists. The problem is : doing in that way I mentioned before every time that client close/open browser the blob reference to file is not valid anymore. Iam looking for FileSystem API, that allows to save data into sandbox section. So, data could be cleaned every time users wanted and im still cant save mp3 references on my server database. Could you guys give me sugestions? The real thing is just save a reference from mp3 local file to allow my user create a playlist and every time that he access the web page he could see that playlists.
Thanks in advance,
http://www.html5rocks.com/en/tutorials/file/filesystem/
I doubt this reference(or "object URLs") persistence thing is intentionally unsupported by the browsers. Otherwise you could access the user's filesystem without his awareness. This could be a security problem.
As quoted at here:
Each time you call window.URL.createObjectURL() , a unique object URL is created, even if you've created an object URL for that file already.

Actionscript is there a way to upload file straight into memory?

I'm looking into uploading an XML file and then storing it's contents in database. It looks like upload method of flash.net.FileReference would do the job however it just gives you an option to upload it to server.
I could upload it to server, read it from that server and then delete that file but I would like to avoid extra work.
Is there a way to just load a file into memory without saving it on some remote location?
No this cannot be done, uploads can only be done to a server, probably for security reason.
If you need to store the content to a database anyway, why don't you make the server-side bakend handle it?
If this is just some data that you need then throw away after the program is complete, perhaps you could consider asking the user to copy and paste their data to some textfield. That might depend on your target audience thought: IT-types - no problem, non-IT types-problem :D
If you are trying to have the user select an XML file from their local machine, after your myFileReference.load(), in your Event.COMPLETE handler function you can use var myXML:XML = XML(myFileReference.data); to get the data of the file you selected.
yes you can load all content in to cache, just push it into an array, when ever you want it just call it out.