Hi Gregory

You should look into this article in the FlashCoders Wiki


http://www.osflash.org/flashcoders/as2#creating_a_class_instance_based_on_mo
vieclip_without_a_symbol_in_the_library

This is if you want to create dynamically a movie clip and then associate a
class to it.
If you allready have a moviclip that you want to use, you should look into
Object.registerClass(³myClipID², MyClass);

HTH

Alain


From: GregoryN <[EMAIL PROTECTED]>
Reply-To: Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
Date: Mon, 17 Apr 2006 17:44:23 +0400
To: Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
Subject: [Flashcoders] good OOP way to re-assign class to clip

Hello Flashcoders,

I have a clip (myClip_mc) associated with class, which is subclassing
MovieClip
(say, MyClass1).
class MyClass1 extends MovieClip ...

To do this, I entered class name as "AS 2.0 Class" in "Export for
Actionscript" dialog.
All this works OK (of course).

But under some circumstances I'd like this clip to be associated with
ANOTHER class (say, MyClass2).
class MyClass2 extends MovieClip  ...

How do I acomplish this in good OOP style?
Few ways I can imagine right now are:
1) myClip_mc.prototype.__proto__ = MyClass2.prototype;
2) Create an "instantiate()" method in MyClass2 to re-write all
props/methods of the target clip with ones of MyClip2 (similar to
EventDispatcher).

Both "ways" above don't seem good from OOP point of view, though...

Can anyone offer something more elegant?




-- 
Best regards,
 GregoryN          
================================
http://GOusable.com
Flash components development.
Usability services.

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to