During last week I had to do a small application for AIR. That was until friday when I had to release it and found out that the app had to work also in normal browser. Since almost all the code was independent of the type of app (AIR/Flex) my task was pretty easy:
- Get all existing code into an external library
- Update the AIR program to use that library and remove all other code except the main function
- Create a Flex App to use the new library
One problem that I found was that my library that was initially written for AIR had some references to the FILE object
that is not available in a normal Flex App. So I had to override my library class to use SharedObjects instead of FILE.
So here is a quick tutorial on how to override a class inside a library (any library - even the flex framework one):
- First locate the exact name of the package you want to override.
Ex: info.flexer.common.storage.Settings (settings beeing the class I have problems with) - In your app create the folder structure info/flexer/common/storage/
- Copy in this path the Settings.as and modify it as you want.
Once you build the project the class you placed in your program will override the one that is in the library.
This only works if the library is merged into code.
Popularity: 41%
Tags: AIR, flex, How to, library
This post was written by Virgil Cristea
Views: 1057



















Can you think of any way this can be done to a framework loaded via RSL?
If you have any problems let me know.