flash actionscript access filesystem without air? - actionscript-3

Is there any workaround to allow actionscript3 write to file system without adobe air?
The reason is because, in order to use adobe air, each of the web visitors will need to install add-on air run-time and that is tedious. Most of the users will have flash plug-in and not Adobe Air.

This is possible in Flash 10.
Take a look at the FileReference class, specifically the save method.
There are certain limitations imposed for security's sake, of course.
The write can only be initiated by user interaction (e.g. a button click), and it will always pop up the host OS's File Save dialog box prompting the user to choose a location (or cancel).

Related

How to set Flash Player window location in Flash project as3?

I have 2 monitors on my computer, also am writing a program on AS3 that is exported to standalone SWF. My task is to make my app fullscreen on 2nd screen. How can I do this?
I tried converting my project to AIR project. It is possible there by using nativeWindow property of Stage. (setting x coordinate so that it appears in second screen and then call fullscreen). It works in Flash, but when I'm running compiled swf outside Flash, my app crashes (nativeWindow property not found).
So please do help me to solve my problem. I am disappointed, have been looking for solution for already 3 days...
You have to stick with your AIR application and use it as it is supposed to: run the .air file. You can't launch an AIR swf alone because it will miss all the AIR runtime including the NativeWindow you are insterested in.
To be clear, you can't manipulate windows from a swf launched with the Flash Player.
Another solution would be to execute your swf from a web browser and use javascript called through ExternalInterface to move the windows. But it may be quite painful in comparison with AIR.

Best way to make a downloadable version of a Flash game?

I already made a game with flash, and I want to provide an easy download for people that would rather play offline. Thing is, i use a folder whole structure to dynamically load content per level. Folder structure looks like this, not that it matters that much:
Game folder
animations
anim1.swf
anim2.swf
sounds
music1.mp3
soundeffect1.mp3
levels
level1.lev
level2.lev
myGame.swf
How should I go to distribute this? Should I just resort to make a zip file for the flash game and assume people know how to extract and open the swf? Is there any other way to port easily as an executable? Perhaps Adobe Air (not sure if this works though)?
Thanks, and please help!
Distributing a zip file is the only option if you really want that structure to prevail. Else,
Embed all the resources in the main (myGame) swf & distribute it.
Provide a html page for people who do not have standalone flash player installed.
Embedding as a single file allows the browser to cache the single swf & allow the player to keep playing offline until cache is cleared. So user might not even need an explicit download.
If you are using Flash Builder it is fairly straightforward to compile the application into a self-installing AIR executable (or DMG on a Mac). It is possible to include the AIR runtime which would avoid potential problems of the user not having the correct flash player for example.
An alternative to AIR would be to create a projector executable from inside the standalone Flash Player or from the Flash authoring environment.
Another option to using a zip file would be to use a free installer creator such as InnoSetup or Nullsoft on Windows, or Packager on Mac. Linux users are generally more tech savvy and so a tar would probably be well understood.
Adobe AIR works wonderfully! I use it for my own project, and your project should transition over to it with little to no modification (any issues should show up in the Compiler Errors and Output). The only downside is that, past AIR 2, there isn't any Linux support.
The other option is obviously to create a standalone .SWF projector inside a zip or installer, but in my opinion, that isn't the sleekest way to deploy for desktop. The advantage of AIR over this is that it gives you access to additional desktop functions that Flash Player doesn't.

Is it possible to monitor or change the system audio volume in Adobe AIR?

I am making a game in AS3 / Adobe AIR that requires the user to react to certain sounds. Is there a way to inform the user up front if the system volume is muted? Moreover, is there a method to change the volume? If not, does an external cross-platform application exist that lets me monitor the volume and that I can call from Adobe AIR?
The only access you may have to sound volum is restricted to the application (Flash player or AIR). You can change it with SoundMixer.soundTransform.volume for the general volume or SoundChannel.soundTransform.volume for a specific sound.
To summerize, you can't access the OS sound manager's settings or state with Flash. That's why many flash websites start with a message asking the users to switch their speakers on.
Native Extensions is the way to go.
You can follow an Adobe tutorial: http://www.adobe.com/devnet/air/articles/building-ane-ios-android-pt1.html
Or download them ready made: https://github.com/nweber/SystemVolumeNativeExtension

Writing text to .txt files using actionscript

Writing text to .txt files using actionscript. how? i couldn't find anything about that in the internet. is that possible? for flash player.
The flash player (the one in browsers) is run through a sandbox which prevents it from accessing or creating files on the users computer (imagine the chaos if it wasn't!), among other things.
You can store persistent data using SharedObject (but this is not readily visible to the user, only useful for storing settings etc).
The other options is to send the data to a web service which in turn would allow the user to download it. Those are your only options really.
Adobe Air is a different runtime, designed to be used for desktop applications. Eg like any program on your computer. It can do a lot more, but has to be downloaded and possibly installed before you can run it (it will not run from within a HTML page).
Check out Adobe AIR: http://www.adobe.com/devnet/air/flash/quickstart/articles/building_text_editor.html
That's impossible from flash player, only from air.

Trying to understand Adobe AIR and full screen mode

This adobe's page says that:
In Flash Player, full-screen mode can
only be initiated through ActionScript
in response to a mouse click
(including right-click) or keypress.
AIR content running in the application
security sandbox does not require that
full-screen mode be entered in
response to a user gesture.
I thought Adobe AIR was a development tool. But this text above is making look like it is either a player, as it is comparing it to the Flash Player.
So, is AIR both development tool and a player?
AIR is not a development tool but rather an application runtime that allows Flex/ActionScript apps to run as a desktop application instead of within a browser window. One advantage of compiling your app as an AIR app is that it is not limited by the security sandbox that comes with running code within a browser. This means you can read/write files, go into fullscreen mode without constraints, etc. On the downside it requires the user to install your application (as well as the AIR runtime, if not already installed) rather than simply accessing your app via a webpage. Hope that helps clarify things for you.