What do we need for flash 10 development?
I'm looking to do some development in flash 10, s开发者_StackOverflow社区pecifically for the new file api (reading/writing files on the user's local machine). What do I need to develop for flash 10, just Flash cs4?:
http://tryit.adobe.com/us/cs4/flash/c/?sdid=ETJMX&
or is there some other ide? All I'm really interested in doing is:
- Make a small swf file which reads a file on the user's machine
- I will host it in an html file
- When file read is done, I just want to send its contents as a string to a javascript function for further processing.
Not sure if I can get away with the free adobe air thing for this? I need it to run in a webpage but I don't intend to do any more development outside of the above,
Thanks
If you want a free solution:
Download Flex SDK, then download FlashDevelop
It's perfect for coding.
As security restriction, every time you want to save a file it pops up the Save As dialog box asking the user where to save it. For loading, on user input, you can call the FileReference.browse(); You can learn more about this class, here.
Also, you can use AIR to save the file: (AIR is flash compiled for desktop, you can't use it for web)
import flash.filesystem.*;
import flash.events.Event;
var docsDir:File = File.documentsDirectory;
try{
docsDir.browseForSave("Save As");
docsDir.addEventListener(Event.SELECT, saveData);
}catch (error:Error){
trace("Failed:", error.message);
}
function saveData(event:Event):void {
var newFile:File = event.target as File;
var str:String = "Hello.";
if (!newFile.exists){
var stream:FileStream = new FileStream();
stream.open(newFile, FileMode.WRITE);
stream.writeUTFBytes(str);
stream.close();
}
}
Yes, you have all you need to create Flash 10 SWFs with the Flash CS4 authoring tool, however:
As AaronLS points out, Flash CS4 is not a particularly good code IDE (it is more aimed at designers). As an alternative to Flex Builder, there is an open source Flash IDE, called FlashDevelop, that is quite good. It still requires CS4 (or some other AS3 compiler, like the Flex SDK, which is free) to compile the code, but you get the benefit of a nicer coding environment.
For such a simple task that only involves code (no design), the Flash authoring environment might be overkill, although it is the simplest way to proceed.
You might also want to check out Haxe (a language), which can compile to SWFs directly, or compile to AS3 code. For this simple application, I would suggest using Haxe, since it is free and easy to use for simple SWFs (no mucking about with MXML, etc). However, Haxe is not everyone's cup of tea.
You could use Flex Builder instead which is more of a true IDE and more programmer oriented, where as Flash CS4 is more designer oriented.
It's absolutely possible to write and compile SWFs using free tools, you can use the free Flex SDK to compile your code, and an editor of your choice. Flashdevelop, is an excellent actionscript editor, and integrates nicely with the Flex SDK compiler.
These tools will let you do all you want to do.
If you're a student or unemployed, you can even pick up the Flash Builder IDE for free.
精彩评论