circle_mc.onPress = function () { startDrag(this, true); } circle_mc.onRelease = function () { stopDrag(); }
The startDrag(this, true);
this = the circle
true = lockCenter;
IF the circle you have created is centered inside the symbol. (align to stage, center center)
it will lock to the center of the circle as you drag
ktu[k-two]
he who hesitates is lost; so i guess i'll wander intently
Are you sure this is real?
Life is Love, Love is Blind, Blind we go through Life.
Life isn't hard, dealing with your self is.
The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.
I have a circle MC, but i want to stay in place. I want to be able to drag it like a spinWheel... I'd like for the drag to only rotate the MC about its center.
I have it rotating and dragging in a rotation... but i can't make it stop snapping to that certain point in the cirlcle MC
Can anyone lend an eye!?
Thanks!
-manny
Code:
stop();
_root.onEnterFrame = function () {
daWheel._rotation -=.2;
};
daWheel.onPress = function(){
// when you press the grip in the daWheel
daWheel.onMouseMove = function(){
// add a mouse move event to the daWheel
// get an angle to the mouse using atan2 (gets radians)
var angle = Math.atan2(this._parent._ymouse-this._y,this._parent._xmouse-this._x);
// apply rotation to daWheel by converting angle into degrees
this._rotation = (angle*360/Math.PI/2);
// rotate the grip opposite the daWheel so it won't rotate along with it
this.grip._rotation = -this._rotation;
}
}
daWheel.onMouseUp = function(){
// if a mouse move event, delete it on mouse up
if (this.onMouseMove) delete this.onMouseMove;
}
good job on finding the trig function. I was looking for it, but didn't look hard enough.
ktu[k-two]
he who hesitates is lost; so i guess i'll wander intently
Are you sure this is real?
Life is Love, Love is Blind, Blind we go through Life.
Life isn't hard, dealing with your self is.
The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.
I took your exact code into my own fla, and when I click on the circle I made (it has a gradient so I can tell the rotation its at) it does not do anything. When I finally move my mouse, it points toward the mouse and does not go to 0 first.
The problem is probably with the grip movie inside... can you post an fla with how those movie clips are setup. That could be the issue.
ktu[k-two]
he who hesitates is lost; so i guess i'll wander intently
Are you sure this is real?
Life is Love, Love is Blind, Blind we go through Life.
Life isn't hard, dealing with your self is.
The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.
function rotateDaWheel () { daWheel._rotation -=.2; }
daWheel.onPress = function(){ this.onEnterFrame = null; // when you press the grip in the daWheel daWheel.onMouseMove = function(){ // add a mouse move event to the daWheel
// get an angle to the mouse using atan2 (gets radians) var angle = Math.atan2(this._parent._ymouse-this._y,this._parent._xmouse-this._x); // apply rotation to daWheel by converting angle into degrees this._rotation = (angle*360/Math.PI); // rotate the grip opposite the daWheel so it won't rotate along with it this.grip._rotation = -this._rotation; } }
daWheel.onMouseUp = function(){ this.onEnterFrame = rotateDaWheel; // if a mouse move event, delete it on mouse up if (this.onMouseMove) delete this.onMouseMove; }
ktu[k-two]
he who hesitates is lost; so i guess i'll wander intently
Are you sure this is real?
Life is Love, Love is Blind, Blind we go through Life.
Life isn't hard, dealing with your self is.
The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.