-
rollOver/rollOut button
i am trying to do rollOut/RollOver function...when mouseover the button, it moves and stops at 200...
I think that i implemented onEnterFrame code wrongly.
xspeed=5;
right=200;
left=50;
this.ball_mc.onRollOver=overFunction;
this.ball_mc.onRollOut=outFunction;
function overFunction() {
function onEnterFrame() { //i suspect that the way i wrote is wrong..
this._x+=xspeed();
if (this._x>right) {
delete this.onEnterFrame;
}
}
}
function outFunction() {
this._x-=xspeed();
if (this._x<left) {
delete this.onEnterFrame;
}
}
-
Prid - Outing
onEnterFrame = function(){
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
it seems not to be working..when i mouseover the button, nothing happens..could my code be written wrongly?
xspeed=5;
right=200;
left=50;
this.ball_mc.onRollOver=overFunction;
this.ball_mc.onRollOut=outFunction;
function overFunction() {
onEnterFrame = function() {
this._x+=xspeed();
if (this._x>right) {
delete this.onEnterFrame;
}
}
}
function outFunction() {
this._x-=xspeed();
if (this._x<left) {
delete this.onEnterFrame;
}
}
-
xspeed is a variable not a function and you need onEnreFrame in the rollOut function. As a point to note you would get smoother movement using setInterval.
xspeed=5;
right=200;
left=50;
this.ball_mc.onRollOver=overFunction;
this.ball_mc.onRollOut=outFunction;
function overFunction() {
this.onEnterFrame = function() {
this._x+=xspeed;
if (this._x>right) {
delete this.onEnterFrame;
}
}
}
function outFunction() {
this.onEnterFrame = function() {
this._x-=xspeed;
if (this._x<left) {
delete this.onEnterFrame;
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|