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

Reply via email to