Hello :)

You must use the __proto__ reference to change the inherit of yours
movieclips :)

example 1 : you create an empty movieclip and you want attach a new class
who extends MovieClip !

import myPackage.MyClass ;

var mc = createEmptyMovieClip("mc", 1) ;
mc.__proto__ = MyClass.prototype ; // i change the default __proto__
reference(MovieClip.prototype) with the prototype of MyClass.
MyClass.call(mc) ; // if you want launch the constructor of the class and
initialize the movieclip

example 2 : your movieclip is allready on the stage, it's the same operation
:)

mc.__proto__ = MyClass.prototype ; // i change the default __proto__
reference(MovieClip.prototype) with the prototype of MyClass.
MyClass.call(mc) ; // if you want launch the constructor of the class and
initialize the movieclip

You can create a function to lauch this hack ... it's more easy.

eKA+ :)

2006/11/23, Dani Bacon <[EMAIL PROTECTED]>:

hi marijan

yeah thats exactly it, im using exactly that - "inject code", to attach my
classes to assets in a SWF file. but what happens is that any MC in that
SWF
that is linked to a class via the symbols properties panel, is ignored.
ive
used registerClass in Main to correct that, which does but not for
instances
that are already on stage. so im looking for another way to attach a class
to a MovieClip instance in runtime ?

thx .. dani

On 11/22/06, Marijan Miličević <[EMAIL PROTECTED]> wrote:
>
>
> as far as I know, FD ignores anything on the stage unless you
> choose  "inject code" compile method, see compiler options within FD,
> hth
> -m
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED]
> On Behalf Of Dani Bacon
> Sent: Wednesday, November 22, 2006 5:50 PM
> To: Flashcoders mailing list
> Subject: Re: [Flashcoders] changing a MovieClip instance class at
runtime
> inAS2 ?
>
> hey TMK. thank you for your interest :)
>
> i started working with FlashDevelop + mtasc and would like to compile my
> projects solely via FlashDevelop. this way i would have the design team
i
> work with set up the symbols and stage with all the visual assets
needed,
> and set up linkageIDs to them. then i would be able to set up those
symbols
> functionality via external code.
> i wouldnt mind linking classes to MCs using the symbols properties
panel,
> but FlashDevelop ignores those links. so using registerClass in Main i
can
> link linkageIDs to classes but that only works for dynamic attachments
of MC
> instances.
>
> any ideas ?
>
> [snip..]
> _______________________________________________
> [email protected]
> 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
>

_______________________________________________
[email protected]
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


_______________________________________________
[email protected]
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