check this out.....
//
// Static MovieClip Extention Class
// author: Ted Patrick
// email: [EMAIL PROTECTED]
// version: 1.0
//
// Supports dynamic instanciation
// Binds MovieClipDataType to Class with Arguments
//
// Usage: MCE.attachEmpty( scope, name, depth [,initObj] [,class]
[,classArguments])
//
//
// Usage: MCE.attachMovie( scope, linkage, name, depth [,initObj] [,class]
[,classArguments])
//
class as.MCE {
static function attachEmpty(t,n,d,i,c,ca){
var a = MovieClip.prototype.createEmptyMovieClip.apply(t,[n,d])
if(a==undefined){
throw new Error("attachEmpty failed")
return
}
for(var b in i){
a[b] = i[b]
}
if(c != undefined){
a.__proto__ = c.prototype
c.apply(a,ca==undefined?[]:ca)
}
return a
}
static function attachMovie(t,l,n,d,i,c,ca){
var a = MovieClip.prototype.attachMovie.apply(t,[l,n,d,i])
if(a==undefined){
throw new Error("attachMovie failed")
return
}
if(c != undefined){
a.__proto__ = c.prototype
c.apply(a,ca==undefined?[]:ca)
}
return a
}
}
----- Original Message -----
From: "Marcelo de Moraes Serpa" <[EMAIL PROTECTED]>
To: "Open Source Flash Mailing List" <[email protected]>
Sent: Wednesday, January 04, 2006 9:11 PM
Subject: Re: [osflash] Programatically registering classes toMovieClip
instances
I think I found a work around it. My menu_item is a MovieClip and as
such does not have any Event management capabilities other than the
callback functions. Maybe using a proxy object that acts dispatches
events when any of the MC events happen (onRelease for example). The
most imporant thing to note here is that multiple object could be
listening for this proxy object, something that would not be possible
with just the callbacks.
- Marcelo.
Johannes Nel wrote:
> the createEmptyMovieClip is the critical bit here. its the same as
> saying can I assign an instance of a class to an existing movieclip
>
>
> On 1/4/06, *Daniel Todd* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> Can't you just use Object.registerClass?
>
>
> http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary609.html
>
> <http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary609.html>
>
>
>
> --
> www.danieltodd.com <http://www.danieltodd.com>
>
>
> On 1/4/06, Johannes Nel <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> > google __proto__
> >
> >
> > On 1/4/06, Marcelo de Moraes Serpa <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> > > Is there a way to programmatically attach custom AS2 classes to
> > > MovieClips created with the createEmptyMovieClip method? My
> cmenuitem
> > > class creates a very simples widget for a menu item and I
> don´t need any
> > > class assets even though I need the event and tabbing
> capabilities of
> > > UIComponent.
> > >
> > > Thanks,
> > >
> > > Marcelo.
> > >
> > >
> > >
> > >
> > >
> > > _______________________________________________________
> > > Yahoo! doce lar. Faça do Yahoo! sua homepage.
> > > http://br.yahoo.com/homepageset.html
> > >
> > >
> > >
> > > _______________________________________________
> > > osflash mailing list
> > > [email protected] <mailto:[email protected]>
> > > http://osflash.org/mailman/listinfo/osflash_osflash.org
> <http://osflash.org/mailman/listinfo/osflash_osflash.org>
> > >
> >
> >
> >
> > --
> > j:pn
> >
> > _______________________________________________
> > osflash mailing list
> > [email protected] <mailto:[email protected]>
> > http://osflash.org/mailman/listinfo/osflash_osflash.org
> >
> >
> >
>
>
> --
> www.danieltodd.com <http://www.danieltodd.com>
>
> _______________________________________________
> osflash mailing list
> [email protected] <mailto:[email protected]>
> http://osflash.org/mailman/listinfo/osflash_osflash.org
> <http://osflash.org/mailman/listinfo/osflash_osflash.org>
>
>
>
>
> --
> j:pn
>
>------------------------------------------------------------------------
>
>_______________________________________________
>osflash mailing list
>[email protected]
>http://osflash.org/mailman/listinfo/osflash_osflash.org
>
>
_______________________________________________________
Yahoo! doce lar. Faça do Yahoo! sua homepage.
http://br.yahoo.com/homepageset.html
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org