Adobe Air Android Debug - actionscript-3

I am using Flash Builder 4.6 to develop an Android game using Air. When I debug on PC it works fine, however when I plug in my Android phone and attempt to debug, I get an error with the location of a db file.
This is what I presently have the location set to:
private static var DefaultDB:File = File.applicationDirectory.resolvePath("com/arakaron/Assets/Database/DefaultDb.db");
What / where should I be setting it to? It seems that when I debug the app, nothing gets transferred to the phone as I can't find any Arakaron resources on the phone.
Any help would be great.
Thanks.

You can't access the DB in this way.
Please use below code.
File.applicationStorageDirectory.resolvePath("DefaultDb.db");
Your db has to be within the application storage. If you want to have inside the folder then you define the folder name like below:
File.applicationStorageDirectory.resolvePath("db\DefaultDb.db");

The File.applicationDirectory on Android refers to your application and assets. On Android this is contained packaged in your APK and assets are decompressed in memory by the OS when you access them. You shouldn't use this directory unless you are reading assets from your package. Assets in this directory can only be accessed via a url and won't have a nativePath property.
Most likely you should use the File.applicationStorageDirectory or if the files can be safely deleted without breaking the operation of your application you should use the File.cacheDirectory.
You can read more on these locations: http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118666ade46-7fe4.html
If you package a database with your application you should use the File copy process to copy the file to one of the above locations before attempting to access it as a database.

Related

Using C fopen in Windows 8 Runtime Component

I am using a cross-platform library in a Windows Runtime Component (C++) in a Windows 8.1 Store (Metro) app. This library makes C style file calls such as fopen, stat, etc.
These operations work fine when the file is in the local app scope (e.g. in the app's local directory). But if the file is located in other locations (for instance on the "Desktop") then these operations fail. Is there a way to make fopen and other file calls outside the local app folder without having to switch to StorageFile? As an alternative I can only think of copying all files to the local app folder.
Regards,

Windows Phone 8 isolated storage

Is it possible to physically copy files to Isolated Storage using the ISETool? I'm trying to add a text file into Isolated Storage and then, through code, check if that file exists. When I do this, I get a "File does not exist" error.
If I add a file to Isolated Storage in code, it works successfully and I can access it in Isolated Storage via the ISETool to copy it to my PC.
Consider scenario 2:
I add a file into Isolated Storage in code, and then using the ISETool get it back to my PC. Without modifying the file, I place the SAME FILE back to Isolated Storage and try to open it through code, I see the same "File does not Exist" error.
You haven't said how you're writing files to Isolated Storage.
Instead, consider using something like Windows Phone Power Tools for this as it makes it much easier to work with files in Isolated Storage.
According to this MSDN article, you are able:
...to replace the files and directories in an app’s local folder on an
emulator or a device with files and directories from your computer....
Steps:
Deploy the app that you want to test to the emulator or a device.
Get the Product GUID for the app specified in the ProductID attribute of the App element of the WMAppManifest.xml file.
Open a Command prompt window and navigate to the location of ISETool.exe.
To replace all the files in the app’s local folder with files from your computer, type the following command using the Product GUID obtained in the previous steps and specify the source directory on your computer.
ISETool.exe rs <xd|de> <product-id> <desktop-path>
The following example shows a command that replaces the files and directories in an app’s local folder with the files from the directory "C:\Data\My Files" on your computer.
ISETool.exe rs xd 11111111-2222-3333-4444-555555555555 "C:\Data\My Files"
Hope this helps!
yes it is possible to copy to and from isostorage of phone or emulator
try this to upload or download files into iso storage
for wp8.1 only
https://isostorespy.codeplex.com/
for wp7
Windows Phone 7 Isolated Storage Explorer
for wp8
Windows Phone Power Tools

WINRT How to declare a file type association for a file without extension

How can i access a file "without" extension in metro application?
Normally you would need to declare the capabilities of the application incl. a declaration which filetype/extension you wanna access, if the file is located in the document library. The problem is the file i wanna access dont have an extension.
Im trying to access some files within a git directory.
Windows has always used the file extension for association with a program. A file without an extension cannot be associated with a program.

Executing Flashbuilder application results in Error 2148 Only local-with-filesystem and trusted local SWF files may access local resources

As the title implies i have problems making a very simple (actually an empty project) to run!
I always get the follwing error:
SecurityError: Error #2148: SWF file file:///C:/Users/Σάββας/Adobe Flash Builder 4/Test/bin-debug/Test.swf cannot access local resource file:///C:/Users/Σάββας/Adobe Flash Builder 4/Test/bin-debug/osmf_flex.4.0.0.13495.swf. Only local-with-filesystem and trusted local SWF files may access local resources.
at flash.net::URLStream/load()
at flash.net::URLLoader/load()
at mx.core::CrossDomainRSLItem/load()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\CrossDomainRSLItem.as:240]
at mx.core::RSLListLoader/loadNext()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\RSLListLoader.as:184]
at mx.core::RSLListLoader/load()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\RSLListLoader.as:156]
at mx.preloaders::Preloader/initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\preloaders\Preloader.as:279]
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:1925]
at mx.managers::SystemManager/initHandler()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:2419]
Is there something i have done wrong? Ι also tried to debug (the empty application) with no success!!
I tried to set the Global Security Settings for the folders involved in developing to always allow but the result is the same!!
My problem is that i will not be able to debug the application which is of verrrryyyy annoying.
I 'm using Flashbuilder 4, FlexSDK4, Mozilla.
Any hint is appreciated!
This error occurs when you try to open an application that uses RSLs in the standalone player or in the browser by using the file system and not a server. It means that you are violating the security sandbox of Flash Player by trying to load file resources.
You must deploy your application and RSLs to a network location, and request the application with a network request so that Flash Player will load the RSL.
If you are testing the application locally, you can add the directory to your Player trust file to avoid this error.

Package SWF into an EXE or APP

I am trying to adjust my Flash development workflow so that I am using Flash Builder for all of my coding and multiple FLA files for the user interfaces. I will be creating an ActionScript project in Flash Builder and then having each FLA export a SWC into a resources folder.
It is important that I retain the ability to export PC and Mac -- EXE and app, respectively -- projector files. Is there a way of doing this with the Flash compiler or any 3rd party tools?
I know that mProjector and similar tools can do this, but I would like a solution that can be automated into my builds.
EDIT 5/14/2010 9:30 AM: One of my options is to use AIR, however...Flash Builder does not let you build an AIR application from an ActionScript project. Another option is to use Zinc...does Zinc have any command line options such that I can include that in my build process?
There are different options available:
Use AIR
Encapsulate your completed project in a fla (setting the document's class to your custom class) and then publish it as win/mac projector
Use a third-party application to convert swf to native executables. The best known option there is probably zinc
and really, You can pack everything into exe. For example, using flajector can convert the file into exe. and you will not need to think about ... was Flash player installed or not...application will be available in any case
you should have a look at zinc. also, if the machines you want to run on have AIR installed, you may simply wanna build an AIR app.
You can build an AIR application from a pure ActionScript project. Apparently it's not as obvious as it should be, but here's one way of doing it:
http://ted.onflash.org/2010/03/air-apps-using-actionscript-only.php
Also the very latest version of AIR (currently in RC stage, so stable enough to use, final version will be released soon) can package the app into an EXE so you don't need to install the AIR framework separately.
AIR packages can also be compiled from the commandline, so should be easy to integrate into a separate build process if you don't want to do it from the Flash Builder GUI.
Turning SWF into an iOS App/OS App via Xcode and Zinc 4.0 (will help Windows users part of the way)
Step 1:Be an iOS Developer with Working XCode, Provisioning Profile, etc.
Step 1: Download Zinc and Install it
Step 2: Using Zinc select to start a new project and pick the .swf file you want to turn into an app
Step 3: Build / Compile the app - this will create a .app and a .exe file if you select to build for all platforms when compiling
If you are a windows developer then this is as far as you go. Enjoy! If you are a mac/ios dev then continue on.
Step 4: Select your new projector file (.app) and click to 'Convert Projector into an XCode project under the 'Project' tab up top
NOTE - For anyone looking for their projector (or .app file on a mac) made by Zinc 4.0+ to turn into an XCode project, you may have to look in your file directory around the .swf file you used to build the projector in the first place. At first I was frustrated for a bit since I (the Finder on my mac) can easily find the new .exe file but it could not see the .app file with search
Step 5: Locate your new XCode project folder (in the same general place and with same name as your .app) and drag it into XCode
Step 7: Make sure your scheme is correct (Mac OSX or iOS), if it is not then go to build settings and go to 'Base SDK' and switch it to the correct one
Step 8: Check your provisioning, (while still in Build Settings) and select the right code signing and provisioning profile for your app, check your bundle id to make sure it will work too, if you get a problem with code signing after this and you are sure your profile is correct then put
--deep
in the 'Other Code Signing Flags' section
Note - My app was set up to be a mac app and so it had some #import calls that I had to remove and remove the reference to the Cocoa framework on the general section, and put in calls to and instead
Step 9: Archive the app to make the .ipa file and submit it to the app store/post it for ad hoc purposes/build it on a dev device
Note - If submitting to the app store/testflight you may want to look at your .ipa file after this whole process, normally an .ipa is just a fancy zip with a 'Payload' folder that contains your app (with a big cancel symbol over the icon) if after decompresing your ipa (after renaming the .ipa to .zip) you see that your top folder is not called Payload or that your app is actually contained in several folders, then make a new folder called 'Payload' move the icon with the cancel sign on it to the new folder and compress it into a .zip then rename the .zip into a .ipa and you should be good to upload the the app store or testflight