Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Contributor
Posts: 27
Registered: ‎03-05-2011
My Device: Blackberry Torch 9800, Playbook Simulator
My Carrier: TELUS

Problem causing app failure == Class flash.filesystem::File could not be found

Hello. 

 

Has anyone successfully tested/ran an APP from Flash CS5 Professional in the simluator with the File class for AIR included in their code?

 

I have been troubleshooting the same issue for quite sometime (almost a month) on another thread in this forum, but I feel that thread is worn out  now that I've discovered what is causing the problem.  I feel like the problem deserves it's own thread.   The issue is that my app only runs in the following environments: Flash test Environment, AIR package (.air) and from the adl command line.   It will not run as a standalone swf and does not run in the Tablet simulator.

 

I built my app using Flash CS5 and have been trying to use the command line to test it in the Simluator (versions 0.9.2 - 0.9.4).   The File class is for AIR only, so as soon as Flash Player tries to open it there is a silent runtime exception that prevents the whole thing from running.  I only recently discovered the exception when I tried to debug my project in a trial version of Flash Builder 4:

 

 

VerifyError: Error #1014: Class flash.filesystem::File could not be found

 

I require the File class to read/write to two xml files within my app.   I am wondering if anyone has successfully compiled an app using the Command-Line-Flash-Pro combo with the file class as part of their code within the .fla(or as3) file. 

squivo
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Problem causing app failure == Class flash.filesystem::File could not be found

What does your import statement look like?

Developer
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A

Re: Problem causing app failure == Class flash.filesystem::File could not be found

[ Edited ]

 


squivo wrote:

Hello. 

 

Has anyone successfully tested/ran an APP from Flash CS5 Professional in the simluator with the File class for AIR included in their code?


 

i have.  my applications use the FIle system for my own Preferences class, which reads and writes data to the applicationStorateDirectory.

 

i write and compile my AIR applications using Flash Professional CS5, i use the command line to compile and install onto the simulator and it runs perfectly.

 

one thing that was causing errors for me, though, which i would be surprised if you just so happened to be doing the same thing, was that my custom class allows the option to write the data as an encrypted ByteArray using EncryptedLocalStore.  however, after a few minutes of hair pulling, i realized that EncryptedLocalStore is only available for applications targeting desktops – ELS is not available, yet, on mobile devices.


PlayBook Applications:
Drop Swatch
Contributor
Posts: 27
Registered: ‎03-05-2011
My Device: Blackberry Torch 9800, Playbook Simulator
My Carrier: TELUS

Re: Problem causing app failure == Class flash.filesystem::File could not be found

It's good.  Like I said, I have no problems running the .swf in the AIR test environment.   If I remove the functions which use the library but keep the import statement, the .swf runs properly. 

 

 

import flash.filesystem.*;

 

I use the fileStream and other directory elements from that library.

 

 

fileStream.open(file, FileMode.WRITE);
fileStream.writeUTFBytes(fileString);
fileStream.close();

....

var xmlFile:File = File.applicationStorageDirectory;
xmlFile = xmlFile.resolvePath("squivo.xml");

 

 

squivo
Contributor
Posts: 27
Registered: ‎03-05-2011
My Device: Blackberry Torch 9800, Playbook Simulator
My Carrier: TELUS

Re: Problem causing app failure == Class flash.filesystem::File could not be found

TheDarkIn1978 -  that is good to know.  There must be something wrong with my setup.

squivo
Highlighted
Developer
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A

Re: Problem causing app failure == Class flash.filesystem::File could not be found

including any AIR specific APIs in your code will run fine from ADL in Flash CS5, but if you try to run that .swf on it's own it will fail.  this is expected.  the .swf will need to be compiled into an AIR application to run propertly on your desktop if you want to test it externally to ADL in Flash CS5.

 

that being said, the File class will read/write to the applicationStorageDirectory from ADL, so you can test it with confidence and see your applicationStorageDirectory contents updating from within Flash CS5 without having to publish and launch an AIR application

 

here's a list of the locations of the applicationStorageDirectory on your desktop:

 

 

  1. Windows 7 / Windows Vista: c:\users\USERNAME\appdata\roaming\APPLICATIONNAME
  2. Windows XP: c:\Documents and Settings\USERNAME\Application Data\APPLICATIONNAME
  3. Mac OS X: /Users/USERNAME/Library/Preferences/APPLICATIONNAME
  4. Linux (Ubuntu): /Users/USERNAME/.appdata/

 


PlayBook Applications:
Drop Swatch
Contributor
Posts: 27
Registered: ‎03-05-2011
My Device: Blackberry Torch 9800, Playbook Simulator
My Carrier: TELUS

Re: Problem causing app failure == Class flash.filesystem::File could not be found

The problem isn't with the File class not working - I know it works - but rather when I compile for the Simulator, using all the proper commands (and many variations of bad ones), I cannot get my app to run. Everytime I compile for the simulator, I get the same problem (the loading dots) which is the same thing that happens when I just click on the .swf.  I've re-installed everything several times (except Flsh CS5)  and tried with/without the environment variable for the command line.  In the last thread, people gave up when I said I had no 'bin-debug' folder to run my command line with the -C option.  That seemed to be the fix for everyone else so I must still be missing something there.  sigh.

 

 

squivo
Developer
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A

Re: Problem causing app failure == Class flash.filesystem::File could not be found

yeah, the -C option use to be the only thing that worked for me also, but then i started to just CD into the folder that contains my .swf, blackberry-xml and myApp-app.xml file, icon and splashscreen images and i didn't need to use the -C option anymore.

 

but both should work without affecting the File API.

 

are you sure the .swf you are compiling into a .bar file is the one that is created when you test with ADL in Flash CS5?

 

also, the myApp-app.xml file that is created by ADL must be replaced with a PlayBook version.  if you compile the one that is created by Flash CS5 it will certainly not work.

 

for example, here's mine:

 

 

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<application xmlns="http://ns.adobe.com/air/application/2.5">
    <id>com.geoffreymattie.dropswatch</id>
    <versionNumber>1.0.0</versionNumber>
    <filename>DropSwatch</filename>
    <description>DropSwatch</description>
    <name>Drop Swatch</name>
    <copyright>2011</copyright>
    <initialWindow>
        <content>DropSwatch.swf</content>
        <aspectRatio>landscape</aspectRatio>
        <autoOrients>false</autoOrients>
    </initialWindow>
</application>

 

 


PlayBook Applications:
Drop Swatch
Contributor
Posts: 27
Registered: ‎03-05-2011
My Device: Blackberry Torch 9800, Playbook Simulator
My Carrier: TELUS

Re: Problem causing app failure == Class flash.filesystem::File could not be found

Mine has many more active xml nodes.  Maybe I should reduce to the bare minimum?

 

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<application xmlns="http://ns.adobe.com/air/application/2.5">
  	<id>squivo.id</id>
  	<filename>Squivo App</filename>
  	<description>Squivos's App that doesn't work</description>
  	<name>Squivo App</name>
  	<versionNumber>1.0.0</versionNumber>
  	<copyright>2011 Squivo</copyright>
	<initialWindow>
    	<content>squivo_app.swf</content>
		<visible>true</visible>
		<fullScreen>true</fullScreen>
		<aspectRatio>landscape</aspectRatio>
		<autoOrients>false</autoOrients>
		<renderMode>auto</renderMode>
		<maximizable>true</maximizable>
		<minimizable>true</minimizable>
		<resizable>false</resizable>
		<width>1024</width>
		<height>600</height>
	</initialWindow>

 

 

squivo
Developer
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A

Re: Problem causing app failure == Class flash.filesystem::File could not be found

i believe the extra tags you have in your app.xml file are only optional, but i don't think they would cause the File class to not function on your app.

 

i think what you should do is try and reproduce the problem in a new simple application – white background with a text file that prints out a text containing the data of your saved file on screen.  allow for editing the text file, write it to disk when edited then restart the app in the simulator to see if it's working for you.


PlayBook Applications:
Drop Swatch