EncryptedLocalStore general internal error

So I’m developing an AIR app, and experimenting with the EncryptedLocalStore features of AIR. I got to a point where I thought my code was solid, but I wanted to erase all the mistakes I’d created in my keychain. So, I went into Keychain Access, and deleted the keychain file that looked like it was associated with my app (wish I had the keychain file name, but it’s gone). When I restarted my app, and it went to write to the keychain, I get this error:

1
2
3
Error: general internal error
at flash.data::EncryptedLocalStore$/processErrorCode()
at flash.data::EncryptedLocalStore$/setItem()

Even more strange, it only threw this error with the app launched via Flex Builder. If I took the AIR file and installed and launched the application, there was no error.

I tried everything I could think of to start over, from recreating my project to reinstalling Flex Builder. Luckily, NoboG on the Adobe support forums pointed me in the right direction. All I had to do was delete the related files in ~/Library/Application Support/Adobe/AIR/ELS/

Now Flex Builder works again on my laptop, and I’m well pleased.

Do not use a collection of flash.filesystem.File objects as a dataprovider

I’m sure someone will fill in the technical details in the comments (hint hint, AIR experts), but here’s what I ran into.

I’m building an image upload system, and I’m allowing people to drag & drop images onto the app for upload. When they drop the images, I put all the File objects into an ArrayCollection, and then I rendered previews in a giant TileList driven off that ArrayCollection. Now, I figured that might be a little intensive, but it was taking 5-10 seconds to scroll down one row. I figured that it was just beyond AIR’s capabilities to render these jpg files (they are 2-10MB each) that fast, even off the local file system. So, I switched my TileList to a List, but had the same problem, even though I was just displaying File.name.

When I had that result, I figured there must be something about the flash.filesystem.File object that was causing the problem. So, I created a shadow ArrayCollection that I filled with a custom object, FileLight:

1
2
3
4
5
6
7
8
9
10
11
12
package org.iotashan.file {
    public class FileLight {
        public var name:String;
        public var extension:String;
        public var nativePath:String;
    }
    public function FileLight(name:String,extension:String,nativePath:String) {
        this.name = name;
        this.extension = extension;
        this.nativePath = nativePath;
    }
}

When I drove the TileList off of the ArrayCollection filled with FileLight objects, performance came back to acceptable levels. Feel free to use that code however you want.

Spellchecking in Flex

I just came across <spellcheck:*>>, a neat replacement for the TextArea and RichTextArea components. It provides client-side or server-side spell checking, along with custom dictionaries.

The best part is that it’s donation-ware, so just claim you built it yourself, it took a week, and pass your hourly rate along to the author*. Just don’t send them $5 and consider yourself even 🙂

*Don’t actually do this.

Changing AIR application directories

I came across an interesting feature of AIR. I was experimenting with the -app.xml file params, and was playing with the installFolder value. As it turns out, if you build a release with one value and install it, then build another release with a different value and overwrite the original install, it still gets installed to the first value. Here’s the example:

This installs to c:\Program Files\iotashan\My Application\MyApp\

1
2
<filename>MyApp</filename>
<installFolder>iotashan/My Application</installFolder>

This normally would install to c:\Program Files\iotashan\MyApp\, but will install to the above original directory if you overwrite your installation.

1
2
<filename>MyApp</filename>
<installFolder>iotashan</installFolder>

The way to fix this is to uninstall the app and delete the leftover directories.