It worked for me (see modified “resizemore.fla” above). It has the OnRollOver and OnRollOffs to control the look of the button, just add an OnPress to make it do something…
as a button inside a movie clip that has the roll over scale script applied to it?
the MC inside actin as a button doesn’t work do you know why?
*Originally posted by Kay *
**with movie clips acting as buttonsanyone know a way around this? **
Lol, yes it does I even tested it with a button movieclip.
*Originally posted by Kay *
**as a button inside a movie clip that has the roll over scale script applied to it?
the MC inside actin as a button doesn’t work do you know why? **
That’s because when you rollOver the host movieclip, you’re already rolling over that causing the button laying underneath not to work anymore. You can solve this by using hitTest in an onEnterFrame handler to check if the mouse is rolling over instead of using the onRollOver handler.
would the script look something like this? (it doesn’t work)
MovieClip.prototype.resizeTo = function(to) {
this.onEnterFrame = function() {
this._xscale = this._yscale=to-(to-this._xscale)/1.2;
this._xscale>to-1 && this._xscale<to+1 ? delete this.onEnterFrame : null;
};
};
onClipEvent (enterFrame){
if (flash.hitTest( _root._xmouse, _root._ymouse, true)){
flash.onRollOut = function() {
this.resizeTo(100);}
else
flash.onRollOut = function() {
this.resizeTo(70);
};
}
}:block:
The code is very simple in this case, but it takes more processor power:
mc.onEnterFrame = function() {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this._xscale = this._yscale=150-(150-this._xscale)/1.2;
} else {
this._xscale = this._yscale=100-(100-this._xscale)/1.2;
}
};
And, if those are the only actions you’re gonna use, it can even be simplified to
mc.onEnterFrame = function() {
this.hitTest(_root._xmouse, _root._ymouse) ? this._xscale = this._yscale=150-(150-this._xscale)/1.2 : this._xscale = this._yscale=100-(100-this._xscale)/1.2;
};
Might look a bit complicated, but it’s exactly the same, it only uses the tertiary operator:
condition ? action_if_true : actions_if_false
try this:
[AS]onClipEvent(enterFrame){
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.resizeTo(100);
} else {
this.resizeTo(70);
}
}[/AS]
scotty;)
edit/Voets is too quick for me(-:
got it working
thanks again for having patience and helping me out:thumb:
No problem