A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Updating code libraries during runtime using RSLs?

  1. #1
    Member
    Join Date
    Feb 2007
    Location
    Sydney, Australia
    Posts
    44

    Updating code libraries during runtime using RSLs?

    I thought this was possible, but I seem to have trouble making it work.

    I want to have my code/class library stored in an RSL (as a SWF online) which is then loaded during runtime by the host SWF. I learned about this technique from Colin Moock in his book Essential Actionscript 3.0 (Chapter 31: Distributing a Class Library).

    Now, I know that if you share graphics between SWFs via RSLs, you can update the graphic in the RSL and have all SWFs that access that RSL use that updated graphic.

    But I want to store code in an online RSL, that is shared by multiple SWFs, and then when the code needs to be updated, I simply recompile the SWF (do I even need to worry about the SWC anymore?) containing the class library and upload and overwrite the existing RSL on the web. Voila! The code is now updated in all SWFs that share that RSL Class Library.

    The problem is, I can't get it to work right. CS3 and CS4 aren't updating and CS5 just crashes on export!

    The code I'm testing with simply outputs some chosen text to screen.
    I want to change the string that's output by changing the code. Nothing fancy now, but it'll obviously be used for far more indepth stuff when (if?) I get this going properly.

    Has anybody else tried to do this before? Were you successful? I could really use your help!

  2. #2
    Member
    Join Date
    Feb 2007
    Location
    Sydney, Australia
    Posts
    44
    Well, I figured out the problem finally and I'm documenting it here in case someone else has a similar problem with it, and for my own records.

    Using runtime shared libraries (RSL's) to dynamically change code/classes at runtime: things to keep in mind.
    When creating your SWC/SWF:
    1. When doing your import of classes, DO NOT try to import an entire folder using ".*" notation! It won't work (as in, import the classes), and even worse, it'll fail silently leaving you to bang your head trying to figure out what's wrong! At least, not for any custom classes such as ones you made. You need to import each class specifically!
    2. When you're finished making your SWC/SWF, remember to remove the .AS files (that were imported into the SWC/SWF) from your source path, otherwise, they'll get bundled into your host SWF, negate the filesize savings and make dynamic updating of the code/RSL/SWF impossible.

    I got my runtime shared library technique originally from Colin Moock's (otherwise excellent) Essential Actionscript 3.0. But I really, really wished he mentioned those two points in the book!

    Also, remember to change your publish settings for Actionscript 3 to make sure your External Library Path points to the corresponding SWC used for compile time checking or you'll get errors.

    This was done in CS4. I played around with trying to do it in CS5, but got tired of it crashing all the time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center