Why can't I add my own properties to starling movieclips?
Why can't I add my own properties to starling movieclips?(5 posts) (4 voices)
You can.. just make your own class that extends Starling's MovieClip class.
Or modify the sourcecode of MovieClip.as to your liking..
If you're wondering why it is not a dynamic class that allows for runtime property assignment, you probably don't need it and it is theoretically a performance hog..
Oh, thanks Jonathan! I will definitely look into that. Yeah, it was the fact that it was static that confused me. Would it be that detrimental if I did in fact make it dynamic?
It would. There is no need to use dynamic classes, ever. All it does is disabling type safety. Just add the property for real.
Rather than extending it an making that class dynamic, you'd be better to include a dynamic object as a property in you new class. That way any classes that extend from that base class will inherit the dynamic element and you won't have a hierarchy of dynamic classes.
You must log in to post.