Fx{r} is trying to start the Fx{r} Community! Please join our group on Adobe Groups following this link: http://groups.adobe.com/groups/ab29539ab9.
Fx{r} is now on Twitter too. Follow us @ twitter.com/fx_r!
«
»

AIR, Flex 2, How to, RIA

Override classes from included libraries

Virgil Cristea | 11.05.08 | 2 Comments

Google Buzz

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):

  1. 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)
  2. In your app create the folder structure info/flexer/common/storage/
  3. 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.

Share and Enjoy:
  • Twitter
  • Google Buzz
  • LinkedIn
  • Google Bookmarks
  • del.icio.us
  • Digg
  • Sphinn
  • blogmarks
  • Reddit
  • StumbleUpon
  • Facebook
  • DZone
  • FriendFeed
  • Yahoo! Buzz
  • Yahoo! Bookmarks
  • Slashdot
  • MySpace
  • Add to favorites




Tags: , , ,

This post was written by Virgil Cristea

Views: 3370

related

2 Comments

have your say

Add your comment below, or trackback from your own site. Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

:

:


«
»