AS2 does not have the concept of an application domain. So if you are loading multiple child SWFs into your AS2 project, any classes that the SWFs share will be cached at their first use. The cached definitions will stand in for any following references to the class. Not always good, and depending on your project, it can cause some pretty serious issues and headaches. Need a way around this AS2 class collision issue? Me too, so I made one.
Yes, we all know the numbers. FlashPlayer 9 is at 97% penetration worldwide. After a year of primarily AS3 development (not starting any new AS2 projects), I find myself working on a project back-porting AS3 into AS2. Ohhhhhh yay, what a joy! I love the screwy event model, the rigid display list, having to fake document classes, not being able to do
new MovieClip(), … and the list goes on… Regardless, this is my task, and I will prevail with flying colors (are you with me?) !
One requirement to keeping the code bases similar is to implement event bubbling in AS2. I looked around for a few techniques we could implement into our ‘new’ AS2 code, but had trouble finding an example that could be added cleanly into our project. We needed something that could extend
MovieClip, and allow any subclass to bubble events up their respective
_parent chain. I definitely found some working bubbling techniques, mainly this one, but decided to re-familiarize myself with AS2 by encapsulating this whole bubbly stuff.
Recently I was asked to use SWX to tie into a CakePHP project. Integrating SWX was a piece of cake (cheap pun :) ), but in the middle of development, walker upgraded our Cake core to version 1.2 and all of our SWX started dying. If you have run into this problem, the fix is pretty simple:
edit all of your gateway files in your webroot (cake_amf_gatway.php, cake_json_gateway.php, and cake_swx_gateway.php) by replacing:
that ought to take care of your BadCall errors.
Some of us are still use AS2 here and there, and some of us want to be able to capture something like the AS3 MouseEvent.DOUBLE_CLICK. I wrote a simple decorator class called
DoubleClickable to give a
MovieClip the ability to broadcast
The example below is hopefully pretty self explanatory :)
Just import the class and wrap your
Movieclip@s with the the @DoubleClickable class.
import com.visicswire.wrappers.DoubleClickable; var dbc:DoubleClickable = new DoubleClickable(star); dbc.addEventListener('doubleClick', Delegate.create(this, _handleDbleClick));
Grab the source files for a hands on example.