Attaching movieclip class without library symbol
July 23rd, 2007
I have just been searching on how to link a class to a movieClip created with ‘createEmptyMovieCLip’ - which at first, seems like there is no answer, but i stumble accross this little nugget which is perfect for OOP component development which you dont want to rely on any assets what so ever.
Hers a little snippet taken from swfoo.com
A more detailed explanation can be found at peterjoel.com
++++++++++++++++++++++++
Actor.as:
class Actor extends MovieClip {
static var id = (id=”__Packages.Actor”)+
(Object.registerClass(id,Actor)?”":”");
public function Actor() {
trace(”Action!”);
}
}
To test:
import Actor;
attachMovie(Actor.id, “_mc”, 1);
works like a charm!
Leave a Reply