PDA

View Full Version : detect mouse on clip, determine quadrant and set property



natronp
February 8th, 2005, 11:21 PM
I'm trying to make a clip that will have another clip attached (eventually it'll be a mask) when you roll over it. I want the mouse positon to be determined on rollover and a different clip (with different registration point) to be attached depending on which quadrant you rollover first. IE- you rollover the lower left quadrant of the mc first so an mc with an upper right registration point is attached and follows the mouse.

basically I want it to look like you're pulling a mask from out of nowhere onto the main mc from whatever corner you start on... (make sense?)

i'm trying to reconstruct what you see here (http://www.mullerphoto.com/)
this is the first baby step!

anyhow, here's my AS and i'll attach the .fla any help is great!


leftfunction = function(){
if (patch._ymouse <= 100){
llowerfunction;
}else{
//this function starts the maskclip coming in from the upper left with a lower right reg point
_root.patch.attachMovie("lowerright", "lrclip", 1);
lrclip._x = _root.patch._xmouse;
lrclip._y = _root.patch._ymouse;
}
}

llowerfunction = function(){
//this function starts the maskclip coming in from the lower left with an upper right reg point
patch.attachMovie("upperright", "urclip", 1);
urclip._x = patch._xmouse;
urclip._y = patch._ymouse;
}

rightfunction = function(){
if (patch._ymouse <= 100){
rlowerfunction;
}else{
//this function starts the maskclip coming in from the upper right with a lower left reg point
patch.attachMovie("lowerleft", "llclip", 1);
llclip._x = patch._xmouse;
llclip._y = patch._ymouse;
}
}

rlowerfunction = function(){
//this function starts the maskclip coming in from the lower right with an upper left reg point
patch.attachMovie("upperleft", "ulclip", 1);
ulclip._x = patch._xmouse;
ulclip._y = patch._ymouse;
}

_root.patch.onRollOver = function() {
if (patch._xmouse <= 150){
leftfunction;
}else{
rightfunction;
}}

tofuisonmyside
February 9th, 2005, 03:34 AM
hi natronp,


just made a quick syntax cleanup with your code:



leftfunction = function () {
if (this._ymouse<=100) {
llowerfunction();
} else {
// this function starts the maskclip coming in from the upper left with a lower right reg point
this.attachMovie("lowerright", "lrclip", 1);
lrclip._x = this._xmouse;
lrclip._y = this._ymouse;
}
};
llowerfunction = function () {
// this function starts the maskclip coming in from the lower left with an upper right reg point
this.attachMovie("upperright", "urclip", 1);
urclip._x = this._xmouse;
urclip._y = this._ymouse;
};
rightfunction = function () {
if (this._ymouse<=100) {
rlowerfunction();
} else {
// this function starts the maskclip coming in from the upper right with a lower left reg point
this.attachMovie("lowerleft", "llclip", 1);
llclip._x = this._xmouse;
llclip._y = this._ymouse;
}
};
rlowerfunction = function () {
// this function starts the maskclip coming in from the lower right with an upper left reg point
this.attachMovie("upperleft", "ulclip", 1);
ulclip._x = this._xmouse;
ulclip._y = this._ymouse;
};
patch.onEnterFrame = function() {
trace(this._xmouse);
if (this._xmouse<=150) {
this._parent.leftfunction();
} else {
this._parent.rightfunction();
}
};



not working perfectly but at least, the attachMovie is working, and you have a better base to go on