Rotating the mc

I asked this before but I was unable to view the answer because I had problems with a modem. So here’s the question.

When you drag a mc it rotates. And when you release drag, it stops rotating and it stays at that point.

Thank you and also I am sorry.

this might work.

place a button inside the movie clip in question… on it’s timeline.

attach to the outside of the movie clip that contains the button, this code

onClipEvent(enterFrame){
if(flag){
this._rotation++;
}
}

attach to the button this script.

on(press){
_parent.startDrag();
_parent.flag=true;
}
on(release){
_parent.stopDrag();
_parent.flag=false;
}

Sorry, Dave… I don’t know if that would work. I’ll give it a shot, though.

My first thought was to make a simple tween that rotate the object

on the movie clip, this code.


onClipEvent(load){
	gotoandstop(1);
}

on(press){
	_root._xmouse=this._x;
	gotoandplay(1);
	this.startdrag();
}
on(release){
	gotoandstop(this._currentframe);
	this.stopdrag();
}

David’s code didn’t seem to work but when you change one line it works perfectly.

onClipEvent(enterFrame){
if(_root.flag){
this._rotation++
}
}
on(press){
this.startDrag();
_root.flag=true;
}
on(release){
this.stopDrag();
_root.flag=false;
}

if you just change the code from _parent to _root it seems to work perfectly.

Hope this helps

Kyle

oh yeah… I forgot to direct that correctly. If it works that way it should also work like this

onClipEvent(enterFrame){
if(flag){
this._rotation++
}
}


on(press){
this.startDrag();
flag=true;
}
on(release){
this.stopDrag();
flag=false;
}

I forgot that a button on the timeline would make a variable on that timeline, which in turn would be readable localy by the movieclip onClipEvent(){} method.

and if you want to make it go faster change this._rotation++ to this._rotation += 5. You change the number 5 to any number you want, the highter the number the faster the rotation.

THank you! Thank you! That’s ok. The first post already helped me! :))
OK. Over.