Button Effect

Hello,

I am trying to make a rollover effect for a button. I have a word typed, the button, and I want to move this word around a certain area, randomly, when the user rolls over it.

Any idea on how this can be done??
I am kind of blocked and haven’t figured it out

thanks

heres an idea, dunno if it works, or if it’ll even make sense though heh…

make a random number for x and for y

and say the random number for x and y are both 50

so then the word will go on coordinates (50,50)

in the overstate of your button make the content a movieclip
then in the movie clip make your content move around by making animations…

you could probably do this in actionscrip, but if you’re novice as me it can be a bit hard

hope this helps!

i was bored so … i spent 5 - 10 minutes of my life in this

place the script in the timeline and remove all those [color=red][/color] in this line: button.wordBox.htmlText = "<[color=red][/color]p align=‘center’><[color=red][/color]font face=‘Verdana’ color=’#CCCCCC’>kax<[color=red][/color]/font><[color=red]*[/color]/p>"

[size=1]

this.createEmptyMovieClip ("button", 0)

button.createEmptyMovieClip ("box", 0)
button.createTextField ("wordBox", 1, 0, 2, 40, 16)

button.box.moveTo (0, 0)
button.box.beginFill (0xFFFFFF, 100)
button.box.lineStyle (2, 0xCCCCCC, 100)
button.box.lineTo (40, 0)
button.box.lineTo (40, 20)
button.box.lineTo (0, 20)
button.box.lineTo (0, 0)
button.box.endFill ()

button.wordBox.html = true
button.wordBox.htmlText = "<*p align='center'><*font face='Verdana' color='#CCCCCC'>kax<*/font><*/p>"

button.onEnterFrame = function () {
	if (this.hitTest (this._parent._xmouse, this._parent._ymouse, true)) {
		if (!newPos) {
			newx = Math.round (- 20 + Math.random () * 40)
			newy = Math.round (- 20 + Math.random () * 40)
		}
		if (newx != this.wordBox._x || newy != this.wordBox._y) {
			if (newx < this.wordBox._x) {
				this.wordBox._x += Math.floor ((newx - this.wordBox._x) * .1)
			} else {
				this.wordBox._x += Math.ceil ((newx - this.wordBox._x) * .1)
			}
			if (newy < this.wordBox._y) {
				this.wordBox._y += Math.floor ((newy - this.wordBox._y) * .1)
			} else {
				this.wordBox._y += Math.ceil ((newy - this.wordBox._y) * .1)
			}
			newPos = true
		} else {
			newPos = false
		}
	} else {
		newPos = false
		newx = 0
		newy = 0
		if (newx != this.wordBox._x || newy != this.wordBox._y) {
			if (newx < this.wordBox._x) {
				this.wordBox._x += Math.floor ((newx - this.wordBox._x) * .1)
			} else {
				this.wordBox._x += Math.ceil ((newx - this.wordBox._x) * .1)
			}
			if (newy < this.wordBox._y) {
				this.wordBox._y += Math.floor ((newy - this.wordBox._y) * .1)
			} else {
				this.wordBox._y += Math.ceil ((newy - this.wordBox._y) * .1)
			}
		}
	}
}

[/size]
if that’s what you want i’ll figure out an easier way :wink:

[size=1]waiting for lostinbeta ilyaslamasse or senocular to belittle me :P[/size]