PDA

View Full Version : Stop movieClip OnEnterFrame


joaoVieira
06-09-2003, 07:33 PM
I'm trying to stop a movieClip, when the mouse roles over it but keep the others moving.

I've got 3 movieClip's with the following instance names:
animal1_mc
animal2_mc
animal3_mc

_root.vazio_mc.onEnterFrame = function(){
for (i=1; i<4; i++){
_root["animal"+i+"_mc"].onRollOver = function (){
_root.instanceName = this._name;
_root.instanceNumber = _root.instanceName.substr (6,1);
_root.number = Number (_root.instanceNumber);
}
_root["animal"+i+"_mc"]._x = _root["animal"+i+"_mc"]._x + 1;
}
}

I can identifie wich one the mouse is over but i canīt stop it, without stoping all the others too.

Could someone give me an ideia of how to do this.

Thank's in advance

Fugee
06-09-2003, 08:13 PM
add the parts in Bold to the script in your frame:
_root.vazio_mc.onEnterFrame = function(){
for (i=1; i<4; i++){
_root["animal"+i+"_mc"].onRollOver = function (){
_root.instanceName = this._name;
_root.instanceNumber = _root.instanceName.substr (6,1);
_root.number = Number (_root.instanceNumber);
}
if (i == number) {
_root["animal"+i+"_mc"]._x = _root["animal"+i+"_mc"]._x;
} else {
_root["animal"+i+"_mc"]._x = _root["animal"+i+"_mc"]._x+1;
}
}
}

Hope it helps ;)


P.S. Ah, use the [AS] [/ AS] tags for code :)

Fugee
06-09-2003, 08:15 PM
ah, if you need the movement to restart on rollOut you'll need to set a rollOut function! :p


Something like this:
_root.vazio_mc.onEnterFrame = function(){
for (i=1; i<4; i++){
_root["animal"+i+"_mc"].onRollOver = function (){
_root.instanceName = this._name;
_root.instanceNumber = _root.instanceName.substr (6,1);
_root.number = Number (_root.instanceNumber);
}
if (i == number) {
_root["animal"+i+"_mc"]._x = _root["animal"+i+"_mc"]._x;
} else {
_root["animal"+i+"_mc"]._x = _root["animal"+i+"_mc"]._x+1;
}
_root["animal"+i+"_mc"].onRollOut = function (){
_root.number = 0;
}
}
}

joaoVieira
06-10-2003, 01:16 AM
Thanks a lot Fugee!

That did the trick for this simplified version.

Wednesday I will try to apply it to the "real" thing, a major project that as a lot more variables in it :)

P.S: Sorry for not using actionscript formated text. I will try to remember that next time. It's in fact much easier to read the code that way.

I'll let you know how it worked on the "big one" :)

Once again, thanks Fugee!

Fugee
06-10-2003, 12:57 PM
Hey, no problem! ;)

Here to help (if i can :p)