Skip to main content
fanglinyong
Inspiring
June 18, 2006
Answered

control the mc

hi:
i want to control the mc ,i created! means that when the mc load, i use the onRollOver function to make it moving from left to right, when the mouse rollout, its stop!
i use the following code:
mymc.onRollOver = function() {
this._x + = 3;
if(this._x > 300) {
this._x = 20;
}
}
mymc.onRollOut = function() {
this.stop() ;
}
but its not work !
thanks very much!
This topic is closed to new replies. Start a new post to keep the conversation going.
Peter LorentCorrect answer
Inspiring
June 19, 2006
mymc.onRollOver=function(){
this.onEnterFrame=function(){
this._x+=3;
if(this._x>300){
this._x=20;
delete this.onEnterFrame;
}
}
}
mymc.onRollOut=function(){
delete this.onEnterFrame;
}

4 replies

fanglinyong
Inspiring
June 19, 2006
good idea, thanks very much!
i will do !


thanks!
Translate
fanglinyong
Inspiring
June 19, 2006
ok, i do as you said, but i means that when the mouse rollover the mc, i want this mc could move until rollout!
thanks your help!
Translate
Peter LorentCorrect answer
Inspiring
June 19, 2006
mymc.onRollOver=function(){
this.onEnterFrame=function(){
this._x+=3;
if(this._x>300){
this._x=20;
delete this.onEnterFrame;
}
}
}
mymc.onRollOut=function(){
delete this.onEnterFrame;
}
Translate
Inspiring
June 18, 2006
>>this._x + = 3;
should be;
this._x += 3;
no space between the + and the =
Translate