actionscript editor
This week, I have been using sciTE|Flash for all my ActionScripting. Although I'd heard of it before, I never got around to checking it out and I was perfectly happy with Code Genie, which I've been using for over a year. Thanks to Paddy, one of my new colleagues, for showing it to me. It's now definitely my ActionScript editor of choice, and a real pleasure to use - once you have adjusted the colour schemes a little, that is ;-)
While I mention Paddy, you should have a look at his website, darklump.co.uk, which is dedicated to his er... dark lump. (a solid sphere of paint, the size of a football). Nick, who's contracting for us - but seems like as much a part of the company as anyone - has a portfolio site, including his 3D FlashCom game, which everyone was talking about a few months back. I'm sure that most of the rest of the boys in the office have sites too, but they haven't showed me yet - so that's their fault :)
This is cool
Marcos Weskamp's Desktop Activity Monitor is a remarkable collaboration of Flash MX, Screenweaver and Flash Communication Server.
[ via sean voisen ]
DataProviderClass != RsDataProviderClass
Yesterday, I needed to use DataProviderClass in an external AS
file, so I didn't want to rely on the symbol, included with data-aware components,
being in the library. I remembered that the RecordSet class, which
is designed for use with Remoting, uses a superClass called RsDataProviderClass,
in whose code comments it says:
// This is used internally as the superclass of the RecordSet class.
// It is an exact copy of DataProviderClass, which is included here
// because of packaging limitations.
Which is great - except that it isn't true. RsDataProviderClass is actually a slightly modified version of DataProviderClass, which has an extra line in several of its methods, which check if it a local instance or not. That would be fine (I suppose) except that it depends on a method of RecordSet (its subclass!?!). The result is that it cannot function correctly by itself and methods like addItem do not work at all.
Lesson learned...
parasite class
I built this class as a helper in my quest for the generic Decorator implementation, in order to manage event handler proxying. This isn't something that has to be dealt with in most languages because events are handled differently, but in ActionScript, we often define event handlers for an object by just adding it from outside of that object. In particular, mouse handlers for MovieClips. I wanted to make a generic wrapper class, which would allow you to wrap (for example) a MovieClip without other objects noticing that they aren't dealing with the real thing. I also wanted to be able to nest these wrappers indefinitely or to wrap a single object twice, with no ill effect.
There are three things that needed to be done. Properties need to be proxied
through, which is easily achieved with addProperty. Methods need
to be proxied, which is slightly simpler, by simply creating a proxy method
for each one - __resolve could also work but there are a number
of associated issues. The final hurdle is event handlers. For objects to use
the wrapped instance and be non the wiser, they need to be able to assign handlers
and remove them. If several objects all try and do the same thing, through
different wrappers it shouldn't break.
So I worked out this little class, called Parasite. It's similar to ASBroadcaster, in fact it implements my Broadcaster class, but it works the other way around. Instead of an object being designed as a broadcaster, the ability is given to it without its permission. Here's an example usage:
myButton.onRelease = function(){
trace("button's release");
}
myParasite = Parasite.addParasite(myButton, "onRelease");
myParasite.addListener(this);
this.onRelease = function(){
trace("parasite detected release");
}
This little class can also be used for applying Branden Hall's Flair pattern to a much wider number of objects, which do not natively support listeners.
See the code here.
