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
> _______________________________________________
> [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