AS3 CASALib Useful Library of Common Functions and Tools for Flash

When you do lots of any language you build up libraries over time that are time savers that are repetitive and tedious if you do not consoildate into a library.  Taking a look at the CASALib, an as3 library of common functions for flash that was released I have many of the same things in my libraries but CASALib just has lots of extras that go a bit deeper than some libraries, is very clean and is organized pretty well.

One cool thing about it is the IDestroyable interface and the CasaMovieClip, CasaSprite, CasaTextField , etcthat all have a destroy() method that cleans up all events, removed instances and even removes it from the parent display object. Gets me thinking why this isn’t just part of DisplayObject in the first place.

From the release:

Here are a few of our favorite things in CASA Lib AS3:

  • Standardized external load API
  • Easily remove listeners with IRemovableEventDispatcher
  • destroy methods make garbage collection easy
  • Large group of utility classes for common manipulations

We will be elaborating further the power of CASA Lib in future blog posts.

As with any new release there will be bugs that emerge, but with your help we promise to release updates often to keep CASA Lib as stable as possible.

1.0.0 Downloads & Documentation



Tags: , , , , , ,

  • sascha/hdrs

    Looks like a nice, helpful library! When looking at their code though again I’m wondering why so many programmers use tons of ‘this’ where it’s not necessary! It seems they don’t fully understand where and where not ‘this’ is actually needed. I’d say get rid of those damn ‘this’es where they aren’t needed!

  • drawk

    Hey Sascha,

    Yeh that actually really bothered me looking at the code. However there are some great ideas in the library that even the observance of the classes, even if you want to recreate them. The _ and the this references were not needed not my style but to each his/her own.

  • Ventur

    Thanks, it great news!

  • Pingback: Glue Blog » Blog Archive » Glue’s favoriete weblinks (deel 2)

  • Aaron Clinger

    Hi Ryan,

    Wanted to thank you for the write-up. I hope you and your readers find the library helpful.

    Now for why I use ‘this’… A lot of people find it unnecessary, but we do it for clarity and to help with scoping. If you have a bunch of properties/variables in a large function you can easily tell if the variable is a temporary variable or a class level variable if it’s prefixed with ‘this’. It’s a readability thing. I know in a lot of cases it’s pretty clear, but we find it easier to uphold a constant rule then make cases for when it should or shouldn’t apply. Prefixing function calls with ‘this’ is also more of a consistency thing then anything else. But it does make it clear the method is part of the class and not an anonymous temp function.

    Similarly with prefixing private or protected methods with an underscore. Seeing a method call you can instantly know if it’s private or protected, without searching for the declaration.

    I know there are parties that feel strongly the opposite, but with the power of open source and a few find-and-replaces they can have their way. :-)

    I’d love any further feedback you or readers have directly, or on the CASA Lib discussion list.


  • drawk

    Hey Aaron,

    On the this thing. Yeh I dont’ think it is an issue and it was clear that it was a clarification on scoping thing. It is somewhat like Python which I am fond of with self. Where that is required and is pythonic for as3 using this is probably not as widespread unless it is to differentiate from from a super or local.

    In any case it is a quality library with great ideas thanks for making it and releasing it. Another cool thing about open source is you get your code reviewed. It helps to solidify your reasoning and maybe might change things who knows. I think the reason it was mentioned was just because it was not common in most AS3 standard code styles. There is a wide range of styles out there depending on where you come from. For instance box2dFlashAS3 is heavily c++ styled, still a quality kit.