Move a button with your mouse, help!

http://www.intentionallies.co.jp/content_normal.html

I know this site is very complex.But just the moving around buttons feature.
Got any AS for this?

Lets say i have a square that i can move aorund on the screen with my mouse. And when its pressed it opens a .swf

Great forum :to:

look up startDrag() and stopDrag(). You can do a search for something like this in kirupa’s forums. Most questions have already been asked once if not twice.

I did that sounds great.
But is it possible to add a AS that makes the MC turn and float like
on the web page i referred to?

simon :bu:

yeah, that’s possible, just add it in the on(press) event (where the startDrag is located).

btw, here is some sample code:

[AS]
on (press) {
startDrag(this);
this.onMouseMove = function() {
this._rotation = this._rotation + .5;
}
}
[/AS]

Just put it on the movieClip you wish to drag and rotate. You can change it, so it turn in different directions depending on which direction you move…

[QUOTE=sintax]btw, here is some sample code:

[AS]
on (press) {
startDrag(this);
this.onMouseMove = function() {
this._rotation = this._rotation + .5;
}
}

How will the script look i want on(release) to just slowly move by it self until stop. Like on the wab page i showed you.
http://www.intentionallies.co.jp/content_normal.html

And is it possible to not just make it rotate one way. But rotate in a simlilar way as web page above.

Im probably asking to much :sailor:
yupp

I experimented a bit this afternoon, cuz i kinda expected you would ask this :wink:

[AS]
on (press) {
startDrag(this);
this.onMouseMove = function() {
var mousePos:Number = this._xmouse;
this.onEnterFrame = function() {
if (this._xmouse > mousePos) {
this._rotation = this._rotation + 1;
} else {
this._rotation = this._rotation - 1;
}
}
}
}

on (release) {
stopDrag();
delete this.onMouseMove;
delete this.onEnterFrame;
}

on (releaseOutside) {
stopDrag();
delete this.onMouseMove;
delete this.onEnterFrame;
}
[/AS]

With this code the movieClip moves in two ways, depending on the direction of your mouse. I know this code isn’t perfect, and it needs some modifications to make it more usable, but it’s a good starting point I guess… The rest is up to you (or someone else :))

The effect your after (the fading out movement) is a bit to hard for me to do right now (busy doing other projects), but I guess it has got something to do with easing. Read some excellent tutorials on:
http://www.bit-101.com/tutorials/

Anyway, I hope was of some assistance :wink: