PDA

View Full Version : [MX]: button in movieclip



Pect
September 18th, 2003, 08:51 AM
#initclip

function slot(){}
slot.prototype=new MovieClip();

slot.prototype.onPress = function (){
trace("testing");
}

Object.registerClass("item",slot);

#endinitclip

- - - - - -

I have a button (with mouseOver states) inside a movieClip [item], after assigning the <slot> class to [item] and overwriting the movieclip's onPress function, when ever the mouse rollover the button, it no longers displays the mouseOver state.

Any idea how I can overwrite the onPress function and have the mouseOver work at the same time?

Thanks (^.^;

senocular
September 18th, 2003, 08:57 AM
When you make a movieclip a button, as you are doing by assigning it an onPress, you are diabling its internal buttons/onPress actions. This, as you can see, includes your interior button. Depending on your setup, there are different ways to get around this. If the onPress you are 'testing' is only meant for the button and not any of the other portions of the entire mc, then just assign it to the button and not the whole mc.

Pect
September 18th, 2003, 09:06 AM
The movieclip was to contain up a large amount of buttons (think in the hundreds), and the onPress function was meant to start a startDrag function. And it wasn't in my inital interest to have startDrag and stopDrag codes for every single one of the few hundred btns (each on a different frame).

senocular
September 18th, 2003, 09:16 AM
you can instead use a hitTest on an onMouseDown to check for the 'press' of the movieclip as a whole and use that to drag. That wont interfere with the button actions.