Hi, I think adding to the prototype would be the easiest way of recasting an external swf into a class. It's like setting up a class linkage in the library except you can't do that with external swfs (as you already know).
Once you got the swf loaded into external_mc you can: // recast it as NewClass external_mc.__proto__ = NewClass.prototype; external_mc.__constructor__ = NewClass; external_mc.__constructor__.apply(external_mc); If you wanted to pass arguments into the constructor you can change last line to: external_mc.__constructor__.apply(external_mc, arg1, arg2, ..., argN); It might not look nice, but it works nice. The external swf functions and behaves just like a symbol would be if you loaded it from your library and the class linkage was setup. Hope this helps. Matthew Jacobi Adobe Consulting - EMEA - MAD -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Glen Pike Sent: 15 October 2006 23:15 To: Flashcoders mailing list Subject: [Flashcoders] Casting external SWF's Hi, I am working on a project where I have been supplied a number of animation scenes in separate SWF's due to the size of the finished animations. All the animation in the SWF's is on the root timeline and some of it is in separate scenes :( In order to sequence the animations, I am preloading these SWF's into a shell application then playing them in order I need to be able to detect when certain frames are reached inside these animations in order to fire off various events - like playing the next one, etc. Rather than extend the functionality of MovieClip by adding to the prototype - the AS1 way - is there a better way of gaining some control over these clips? I would love to cast them as a subclass of movieclip which dispatches events and can play backwards forwards, etc. but as I am dealing with the root timeline, I guess I cannot cast the MovieClip object as something with extra functionality? I have the FLA's so at worst, I could move all the frames from the root timeline into a clip linked to my subclass, but as there are a lot of scenes, this is not a desired course of action. Thanks for your help Glen _______________________________________________ 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