Hi All,
Sorry guys I did not show up for long i was down, I have a movieclip and I want it to Vibrate on rollover. How do I do that?
Someone Help Fast Plz.
Thanks in Advance.
FlashFile :hair:
Hi All,
Sorry guys I did not show up for long i was down, I have a movieclip and I want it to Vibrate on rollover. How do I do that?
Someone Help Fast Plz.
Thanks in Advance.
FlashFile :hair:
Put this on your movieclip
on(rollOver) {
over = 1;
}
on(rollOut) {
over = 0;
this._x = originalX;
this._y = originalY;
}
onClipEvent(load) {
originalX = this._x;
originalY = this._y;
}
onClipEvent(enterFrame) {
if(over) {
this._x += Math.random()*(.5 - -.5) + -.5;
this._y += Math.random()*(.5 - -.5) + -.5;
}
}
I can comment it out line by line for you if you don’t understand. To make it go faster, you need to use it with a higher frame rate, I tested it at 24 fps.
Hey Yeldarb
Thanx It really work as i wanted it but if u can I will like you to tell me what each of the lines of code do.
plzzzzzzzzzz?
FlashFile
Yep, sure thing.
on(rollOver) {
over = 1;
//This sets the variable "over" to 1 when you roll over the movieclip
}
on(rollOut) {
over = 0;
//This sets the variable "over" to 0 when you roll off of the movieclip
this._x = originalX;
//This sets the X position back to the original
this._y = originalY;
//this sets the Y position back to the original
}
onClipEvent(load) {
originalX = this._x;
//this saves the original X that will be recovered later
originalY = this._y;
//this saves the original Y that will be recovered later
}
onClipEvent(enterFrame) {
if(over) {
//This checks to see if "over" is true or false on every frame
this._x += Math.random()*(.5 - -.5) + -.5;
//If it is, it moves the movieclip left or right a random amount between -.5 and .5
this._y += Math.random()*(.5 - -.5) + -.5;
//If it is, it moves the movieclip up or down a random amount between -.5 and .5
}
}
Pretty straight forward
If you need any more help with it, I’d be glad to.
thanx,
Thank you very much i think i have to go and study this as much as I can so that I can do it any where any time.
Thank you very much
FlashFile
Yep, no problem. I wouldn’t study it too hard though, it’s not as efficient as it could be. The onClipEvent(enterFrame) uses too much CPU power. If you really wanted to make it more efficient, I think you could use functions to call the onClipEvent(enterFrame), but it would be a bit more complicated and I don’t know how much it would optimize it (if at all).
Keep practicing though, this stuff will come
ok,
Thanks once more.
:: Copyright KIRUPA 2024 //--