I just learned this evening why Flash’s inheritance sux. OMG, wtf…
2 Replies to “Inheritance”
Comments are closed.
Software, Fitness, and Gaming – Jesse Warden
Software | Fitness | Gaming
I just learned this evening why Flash’s inheritance sux. OMG, wtf…
Comments are closed.
Hi Jesse,
I feel your pain. I finally figured out that whole hullabaloo about inheritance in Flash as well. As far as I understand it, there is a pretty easy fix for this.
Place the following line at the start of the constructor that you are inheriting from:
if(this._name==undefined) return;
This way the constructor’s init will only fire if it is in a movieclip (and thus needs to be called).
You can read about it on this flashcoders thread:
http://chattyfig.figleaf.com/ezmlm/ezmlm-cgi?1:mss:39543:200207:fdpipimlddhaciadhmci
or at Burch Blog:
http://radio.weblogs.com/0107886/2002/07/01.html#a11
Rock! That is so much better than the solutions I heard about. Thank you so much!
I really don’t mind adding that to my super classes at all. Tight solution.