Thanks Robert for your help. Just for the record, I have the following
code on the mc at the moment - hold down shift and drag the mouse for
rotation to occur. It's not very good - I'm still trying to improve
it, to remove that rotation "jump" you can see when you first hold
down shift and drag the mouse.

onClipEvent (load) {
    clicked = false;
}
onClipEvent (enterFrame) {
    X = this._x;
    Y = this._y;
    if (this.hitTest(_root._xmouse, _root._ymouse, true) && Key.isDown(1)) {
        clicked = true;
        this.startDrag("");
    }
    if (Key.isDown(Key.SHIFT) && clicked == true) {
        this.stopDrag();
        Xm = _parent._xmouse;
        Ym = _parent._ymouse;
        Xdiff = Xm-X;
        Ydiff = Ym-Y;
        radAngle = Math.atan2(Ydiff, Xdiff);
        this._rotation = radAngle*360/(2*Math.PI);
    }
}
onClipEvent (mouseUp) {
    if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
        clicked = false;
        this.stopDrag();
    }
}



On 15/11/05, Robert Wąs <[EMAIL PROTECTED]> wrote:
> I explayned only an idea. I can't help you ;) especially if i not see
> your code.
> Robert Wąs
>
> Amanda Kuek wrote:
> > I gave this a go, (and fixed up a few things) but for some reason, the
> > function rootateLoop is never actually called. Would you have any idea
> > why?
> >
> > On 14/11/05, Robert Wąs <[EMAIL PROTECTED]> wrote:
> >
> >>Simple recipe:
> >>carMC.rotateButton.onRelease=function(){
> >>this._parent.intvId=setiInterval(this._parent."rootateLoop")
> >>}
> >>carMC.onPress=function(){
> >>this.pressed=true
> >>}
> >>carMC.onRelease=function(){
> >>clearInterval(this.intvId)
> >>}
> >>//you have registration point in centre of car
> >>carMC.rootateLoop=function(){
> >>if(!this.pressed)return
> >>var rotation=Math.atan(Math.tan(this._ymouse/this._xmouse))*180/Math.PI
> >>/*
> >>there some stuff with cyclic's properties of tangent function, type:
> >>  if(this._xmouse>0 && this._ymouse<0)
> >>{
> >>rotation= -1 *rotation
> >>}
> >>//sory but not have free time for real results
> >>*/
> >>this._rotation==rotation
> >>
> >>}
> >>
> >>Robert Wąs
> >>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to