Hello :)

you can use VEGAS (http://vegas.riaforge.org/) my openSource framework for
example... with this class DisplayFactory and the method createChild or
attachChild :

1 - download the project on RIAForge or use a Subversion client like
TortoiseSVN to upload all the versionning project with the url :
http://svn1.cvsdude.com/osflash/vegas/

2 - install the AS2/trunk/src directory of the project in your Flash
classpath preferences...

3 - use my DisplayFactory class with your custom class... you can find an
example in the directory AS2/trunk/bin/test/vegas/util/factory with the file
"DisplayFactory.fla" :

http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/bin/test/vegas/util/factory/

you can use too my vegas.util.ConstructorUtil class with the method
createVisualInstance() :

import vegas.util.ConstructorUtil ;

var mc1:MyButton = ConstructorUtil.createVisualInstance( MyButton , mc1 ) ;
var mc2:MyButton = ConstructorUtil.createVisualInstance( MyButton , mc2 ) ;

PS : my french tutorial to install VEGAS ->
http://www.ekameleon.net/blog/index.php?2006/03/05/27--vegas-installation

If you work in AS2.. you can too create a custom class who extend MovieClip
and use a movieclip symbol in your library with the link parameters of the
symbol.

EKA+ :)






2007/3/29, Matheus Araujo <[EMAIL PROTECTED]>:

It worked... but just for the "mc" instance...

I have lots of MCs working as buttons on my movie
and I don't want to call the function on each button...

I need to have a listener to detect which MC has an
onRelease on it and set an onRollover function to them...

Is that possible?
thx


On 3/29/07, eka <[EMAIL PROTECTED]> wrote:
>
> Hello :)
>
> try this :
>
> // constructor of the class
> _global.MyButton = function()
> {
>      trace( this + " constructor) ;
> }
>
> // inject addListener, removeListener and broadcastMessage methods in
the
> prototype
> AsBroadcaster.initialize(MyButton.prototype) ;
>
> // the methods of your custom class
> MyButton.prototype.onRollOver = function ()
> {
>    if (this.onRelease != null || this.onPress != null)
>    {
>        this.broadcastMessage("click", this) ;
>    }
> }
>
> // test
>
> var listener:Object = {} ;
> listener.click = function( target )
> {
>       trace( "click : " + target ) ;
>       functionName(param);
> }
>
> mc.__proto__ = MyButton.prototype ; // change the prototype scope of the
> visual instance "mc"
> MyButton.call(mc) ; // launch the constructor of the MyButton class over
> the
> visual instance.
>
> mc.addListener( listener ) ;
>
> //
>
> EKA+ :)
>
>
> 2007/3/28, Matheus Araujo <[EMAIL PROTECTED]>:
> >
> > Hello coders...
> >
> > I'm trying to create a MovieClip prototype function to all my MCs that
> are
> > buttons:
> >
> > MovieClip.prototype.onRollOver = function (){
> >     if (this.onRelease != undefined || this.onPress != undefined)
>
>
>
> {
> >         functionName(param);
> >     }
> > }
> >
> > The problem is that it doesn't work with the movie clips inside the
ones
> > in
> > the first level...
> > Is there Any way to accsess these movie clips?
> >
> > Thanks in advance
> > Matheus
> > _______________________________________________
> > 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
>
_______________________________________________
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