They have to extend the MovieClip class in order to be able to do that, am I wrong?
I mean, If I load an swf with loadMovie (instead of creating an instance with new) nothing assures me they are going to implement that class. I'm a little lost in the relationship between movies and classes because I always do composition, so I don't know how to load a movie and pass that movie an interface. On 11/9/06, Zárate <[EMAIL PROTECTED]> wrote:
My 0.00002, Basically it really depends on what are they doing. Say you have a player or main movie. You're tipically going to load different movies or sections on it. And you want all sections to have a common list of public properties and methods. Define that list and make it an interface. Then, you can tell anyone: "do whatever you want BUT you have to implement this interface" If they compile against that interface you know that _at least_ some properties and methods are going to be there for your calls. So within your main movie you can do something like: container.loadMovie("externalMovie"); [after fully load] container.config() container.start(); Of course if you have defined those methods in your interface. You won't need to recompile anything. Makes sense? Cheers, On 11/8/06, Glen Pike <[EMAIL PROTECTED]> wrote: > Hi, > > Whilst this suggestion is not good practice if you can get in at the > start of a project - I would recommend doing things the way others have > said, by using interfaces, I was given a very nice workaround for a > situation I got stuck in recently. > > I was given about 20 SWF & FLA files, where all the animation was > done on the root timeline - not in a movieclip. These were to be loaded > into a shell application and I needed to have some control over the > playback of the animations, know when they finished or hit certain > frames etc. It would have been perfect if the animations were each > contained within a MovieClip that was linked to a class of my choosing, > but I did not get to speak to the animators as I was lower down in the > food chain for this job. As I did not wish to copy and paste thousands > of frames of animation into child clips with the correct class linkage, > I asked for some help and was told, I could "recast" the loaded SWF > movieclips into a class of my choosing. This worked beautifully and > saved me hours of extra work, > > Credit to [EMAIL PROTECTED] for his solution below -thanks a million! > > "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 > > _______________________________________________ > 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 > -- Juan Delgado - Zárate http://zarate.tv http://dandolachapa.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
_______________________________________________ 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