How do I save the current frame to be loaded later? - actionscript-3

Hello everyone and thanks in advance for any answers.
What I am trying to develop is quite difficult and I fear it may be beyond ActionScript and Adobe Flash CC, however I will try and see.
I wish to create an app that allows users to upload their own image (bitmap) and that becomes the background of the frame, they can then drag shapes onto points in the image and add text so that they can click the circles and see what info is said about that point.
I am unsure how to achieve certain aspects of this.
The main functionality I require assistance with is saving the scene as a swf so that it can be loaded back into Flash Player from within the Flash App.
Is any of this achievable?

Yes, this app is rather non-trivial, but very doable (and it has been done many times before.)
The main functionality I require assistance with is saving the scene
as a swf so that it can be loaded back into Flash Player from within
the Flash App.
This isn't necessary to do what you describe. If the user has uploaded the image to a server, you can also store user information on a server that describes the other aspects of the user's screen (shapes, text, etc). Then you only need to load in the data and reconstruct the scene.
The basic flow would be:
User selects an image using FileReference/browse() then use FileReference/upload() to send it to a server-side script (for example PHP) that stores the file to a database.
User performs the actions you describe to create shapes, text, etc, and you record it as XML or JSON format.
You send the XML or JSON scene data to the server using URLLoader.
You associate the scene with some kind of identifier. A server-side query can now take that identifier and return the XML or JSON scene data.
To display the scene, you load the XML or JSON scene data using URLLoader and reconstruct it using Loader to load remote images, and re-create the shapes, text, etc from the scene data.
The end result would enable you to share the scene with anyone using the SWF that is able to reconstruct the scene.
You could use this same approach without a server, and instead store the scene data locally using SharedObject or FileReference/save() in the Flash Player, or File or EncryptedLocalStore in AIR. All these methods would also allow you to store the data as AMF (ActionScript objects).

Related

Getting data from Flash that playing online

It somehow should be possible to get all data from Flash File that running currently in browser.
Get all data from rendered objects like values, positions and ect. The more inforamation the better
So what I think is if my computer my adobe flash render all this locally so I'm receiving already it to my computer so I need to read as adobe flash render this.
Look at how Scout works (some info here)
It opens a TCP/IP telemetry channel from which it receives all informations about the movie playing.
I suppose the data would be pretty hard to figure out, plus the movie would have to have the telemetry feature enabled ... but it's a start

Game Maker Studio HTML5 localStorage issue

I'm embedding GMStudio game in browser using . I need to send some data to the game from site's frontend in JSON and to receive some data from the game in frontend to make consequent actions.
So, my idea before was to save data in cookies/localStorage and to get it in the game somehow, using HTTP functionality or DLL's. Also, I'd like to emit messages from the game using window.parent.postMessage and receive them in frontend correctly.
Alas, I did not find a way to implement this. I hope there's some consistent approach to this problem about which I do not know.
The backup plan is to use Game Maker http_post_string and web sockets to get user's data before game's start and to make frontend do something after game's ending. It's clumsy and insecure, however.
The standard approach is to make a JavaScript extension.
That is done by creating a blank extension, adding a blank JS file to it, defining the functions via the context menu on it, and then adding the implementations into the JS file. Then you'll be able to call them from GML side as per usual.
This way you can access LocalStorage\Cookies, transmit\receive data from JS backends, and overall mess with the runtime as you please (with various degrees of understanding required to access internal data).

Chrome's Flash player Shared Objects and External Flash Player Shared Objects

I am working on an AS3 application. I need to store some data locally (on user's machine). I used Shared Object concept. Now in chrome, the default flash player (pepper flash) stores the shared object in a different folder. So if a user changes from the default flash player to externally installed flash player and vice versa (by disabling/enabling flash player from plugins) there will be loss of data. Let me simplify. External flash player stores shared object at 'A' and pepper flash at 'B'. If I switch the flash players, i will miss the data at 'A'/'B'. How can I solve this problem? Is there a way to retrieve the data? Please help me.
Because the Flash plugin itself controls where shared objects are stored and you cannot (as far as I am aware) change that location nor determine what that location is, there is nothing you can do about this one, unfortunately. You will have to deal with the lost data. It will happen eventually anyway, because I believe shared objects are cleared when you clear temporary browser data (or at least they should be, anyway).
On the bright side, the average user does not know you can switch between plugins nor do they know how. The vast majority of Chrome users, even those with a more technical background, will be using the terrible Pepper Flash plugin, so your scenario should be a rarity.
There is a way around it, however. You could set up a remote server and store the shared object there. That way it is not stored locally and you decide where it is actually stored. I personally can't think of a situation where this would be preferable to having a couple users lose their data, but it might fix things for you.

SWF hosting security

I have started developing a drawing application in as3. I am thinking that I could integrate a cms and allow swf files to be uploaded in runtime as graphics.What are the potensial security issues involving third party possibly malicious swf files here?
I would simply be adding the swf as a custom sprite class to a masked container sprite.
Does this open a hole to run other scripts ( js on another server? ) and or give access to the client's computer in unsafe ways?
I would appreciate any recomendations reading and or advice / experience in swf hosting like this. I see this being done on many sites now such as wonderfl and activeden.
This is the ActionScript equivalent to XSS. Your domain will no longer be protected by the Same Origin Policy. This can be used by an attacker to hijack a Session ID (Cookie), deface your web site, or deliver exploit code to any browsers visiting your site.
I think instead of saving a whole mess of SWFs on the server, it would be better to serialize your drawing data, and have your main SWF just redraw the drawing based on the loaded data. You can still use a CMS/Database to store and manage this data.
EDIT*
If you need to load SWFs, take a look at Specifying loading context. And maybe also take a read through Loading Content.

Flash CS4/AS3 Writing local file from local game without save dialog prompt?

I'm writing a game to be run locally, on the user's computer. NOT over the internet.
I want to have a file that will hold the usernames and avatar indices (they're in an array).
I want to know if there's a way to write to files through Flash with AS3. I'm using CS4.
I'd also like to know if you can delete files through Flash, though that's just optional.
Thanks in advance for any help you can give.
If you want to make a game that runs locally on someone's computer, you should make it in Adobe AIR. AIR apps can read and write files, and do all sorts of useful things like show updates in the taskbar, etc. Whereas a simple SWF that you download and run locally can't do anything useful that it couldn't already do in the browser - it can't write or delete local files, for a start. (It can read local files, but only if you disable it from accessing the network.) Moreover, the standalone Flash player is not generally disseminated, so unless the user is a Flash developer they're just going to view your SWF in a browser anyway (unless you plan to publish projectors, which I also wouldn't recommend).
With all that said, however, even if you do your game as local flash content, you can still store information by using SharedObjects. They work the same way offline as online. You can't write the data out as a separate file, but you can store it between sessions easily enough.
if i understand what you are trying to do then why dont you use Adobe AIR? this is flash for the desktop