On 8/11/06, Matthias Dittgen <[EMAIL PROTECTED]> wrote:
but it doesn't work for me, because I don't want to get onRollOver
from the superclass ( I don't do an extend). I just want to add some
functionality to the onRollOver of the same instance of a movieclip.

You have two options (or more, but they are variations):

One is to do something like this:

var f = function () {
 mc.showToolTip();
 mc.call( mc, arguments.callee.oldRollOver );
};
f.oldRollOver = mc.onRollOver;
mc.onRollOver = f;

(Of course, you could also simply rename mc.onRollOver to
mc.oldRollOver and call that instead of doing the arguments.callee
thing.)

That's all nice as long as you only add new funtionality, but if you
want to remove one of the behaviours, you have a problem because it's
buried somewhere in the chain.

The alternative is to keep a table of onRollOvers:

mc.rollOvers = {};
mc.addRollOver = function ( id : String, behaviour : Function ) {
 this.rollOvers[ id ] = behaviour;
};
mc.removeRollOver = function ( id : String ) {
 delete this.rollOvers[ id ];
};
mc.onRollOver = function () {
 for( var i in this.rollOvers ) {
   this.rollOvers[ i ]();
 }
};

Use it like this:

mc.addRollOver( "highlight", mc.doHighLight );
mc.addRollOver( "tooltip", mc.showToolTip );


Both could of course be done much nicer, but you get the idea.

HTH,
Mark
_______________________________________________
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