PDA

View Full Version : actions only enabled on mouse over



jagunco
March 4th, 2003, 02:30 PM
Hi there, I have a problem I canīt resolve, in the attached file there are 2 MC, I want to activate the ball_mc only when Iīm over other MC. I tried multiple things but I canīt manage to find what is the problem, can you of the gurus take a look at it please.

thanks

//jagunco boy

pom
March 4th, 2003, 05:49 PM
I don't understand your code:
meover.onEnterFrame = function() { // WHAT IS MEOVER??
trace("olá");
var acceleration = 10;
var friction = .80;
maxX = 760;
minX = 0;
ball_mc.moveToMouse = function() { // BAD IDEA TO DECLARE A FCT LIKE THAT
var xdif = this.targetX-this._x;
this.xspeed += xdif/this._parent.acceleration;
this.xspeed *= this._parent.friction;
this._x += this.xspeed;
this.checkDistance();
};
ball_mc.checkDistance = function() {
if (Math.abs(this.targetX-this._x)<0.2) {
this._x = this.targetX;
}
};
ball_mc.onMouseMove = function() {
if ((_root._xmouse>=minX) && (_root._xmouse<=maxX)) {
//trace("olá");
this.targetX = this._parent._xmouse;
this.onEnterFrame = this.moveToMouse;
} else {
this.targetX = this._parent._x;
}
};
};Can you explain a bit?

jagunco
March 5th, 2003, 03:22 AM
Hi there, I rebuild the file. I want to have the effect on the red square only happens when the mouse hits the blue square.

thanks for trying to help me

// jagunco