[Flashcoders] how to not overwrite methods, but append functionality

2006-08-11 Thread Matthias Dittgen
Hello list, my tooltip class uses code like this mc.onRollOver = function() {} to add its tooltip functionality to a movieclip mc. But this way it overwrites the onRollOver method of mc and disables the functionality like highlighting. So now my question (probably a really simple one): How is

Re: [Flashcoders] how to not overwrite methods, but append functionality

2006-08-11 Thread Martin Wood
Matthias Dittgen wrote: Hello list, my tooltip class uses code like this mc.onRollOver = function() {} to add its tooltip functionality to a movieclip mc. But this way it overwrites the onRollOver method of mc and disables the functionality like highlighting. So now my question (probably a

Re: [Flashcoders] how to not overwrite methods, but append functionality

2006-08-11 Thread Matthias Dittgen
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. it's like that: var mc:MovieClip = this.attachMovie(MyClipClass.SymbolName,mc,

Re: [Flashcoders] how to not overwrite methods, but append functionality

2006-08-11 Thread Alexis Glass
Do you mean you want to do something like... var oldRollOver:Function = this.onRollOver; this.onRollOver = function () { trace(new onRollOver functionality); oldRollOver(); //call pre-existing functionality } Matthias Dittgen wrote: but it doesn't work for me, because I don't want

Re: [Flashcoders] how to not overwrite methods, but append functionality

2006-08-11 Thread Johannes Nel
var f:Function = mc.onRollOver mx.onRollOver = function () { f(); } you might want to look at function.apply to get it too call in the right context. 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

Re: [Flashcoders] how to not overwrite methods, but append functionality

2006-08-11 Thread Martin Wood
in MyTooltip you can re-assign the onRollOver to another name and call that from the new onRollOver, like this : in MyTooltip mc.onRollOver2 = mc.onRollOver; mc.onRollOver = function() { // some stuff here // call the original this.onRollOver2(); } thats one way of doing it martin

Re: [Flashcoders] how to not overwrite methods, but append functionality

2006-08-11 Thread Mark Winterhalder
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

Re: [Flashcoders] how to not overwrite methods, but append functionality

2006-08-11 Thread julien castelain
hi, maybe using mx.events.EventDispatcher could help i'm probably wrong, but have you tried ? class A { function onRollOver() { doTheRollOver(); dispatchEvent({type:onRollOver, target:this}); } function doTheRollOver() { // do somtehing here } }

Re: [Flashcoders] how to not overwrite methods, but append functionality

2006-08-11 Thread Matthias Dittgen
whoooaaa! Thank to all who answered!!! I have to read through your answers and some testing before I can make further comments. Matthias ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive:

Re: [Flashcoders] how to not overwrite methods, but append functionality

2006-08-11 Thread Ian Thomas
I agree with Julien - EventDispatcher is ideal for this purpose. It's one of the reasons it exists - to allow more than one object to be notified when an event occurs. Ian On 8/11/06, julien castelain [EMAIL PROTECTED] wrote: hi, maybe using mx.events.EventDispatcher could help i'm probably

Re: [Flashcoders] how to not overwrite methods, but append functionality

2006-08-11 Thread janosch
Hello, some time ago i postet at flashforum.de how this can be done, without drawbacks to the rest of the application: http://www.flashforum.de/forum/showthread.php?t=207998 Its in german but the code is more or less internation :) Janosch Matthias Dittgen schrieb: Hello list, my