learning through interaction
If you need to create a directory from Air and you dont know how, mostlikely you will use the Adobe Air Documentation and use something as the following:
it all looks nice and makes sense but in the real world it wont work, you would get an error like this:
Type Error : Value undefined ( result of expression air.File.createDirectory ) is not object.
# of your code error.
The problem with this approach is that the createDirectory method doesnt take any parameters, if you try to pass values directly to the method you will get this error:
Argument Error : Error #1063: Argument count mismatch on flash.filesystem::File/createDirectory(). Expected 0, got 1.
Once i was able to get this error I realized that the docs were wrong, or at least on this specific section. So looking at a different sample I figured out this works:
[js]
var directory = air.File.documentsDirectory;
directory = directory.resolvePath("Air Test");
directory.createDirectory();//no parameters necessary, Air knows where we need the new directory.
[/js/]
By first "asking" Air if the directory exists then Air knows where to create the new Directory rather than passing the property directly to the method.
This applies to Adobe Air SDK 3.0 and using Javascript
Tags: Air, Adobe, Javascript, SDK
During the day I work as a Sr. Rich Media Designer for T3, During the evenings I enjoy the best time of the day as a husband and a father and sometimes during the nights I work for myself at multimedia247.
This blog is mostly about my findings on the web, my contribution to noobs to flash that might be able to learn something from the site. If you dont consider yourself a noob and you still were able to learn or discover something new on this blog, even better.
Leave a reply