-
two mc on stage alter eachother
Hello,
Two MovieClips on stage, the code in each one is the same as the following:
onClipEvent (mouseDown) {
//
if (_currentframe == 1) {
this.gotoAndStop(2);
} else if (_currentframe == 2) {
this.gotoAndStop(1);
}
//
}
But when either mc is clicked, the two mc(s) behave the same (either go to 2nd frame or back to 1st at the same time). Even when every mc was given an instance name e.g. mc1, mc2
and the code change as the following;
//for mc1
onClipEvent (mouseDown) {
//
if (_root.mc1._currentframe == 1) {
_root.mc1.gotoAndStop(2);
} else if (_root.mc1._currentframe == 2) {
_root.mc1.gotoAndStop(1);
}
//
}
//for mc2
onClipEvent (mouseDown) {
//
if (_root.mc2._currentframe == 1) {
_root.mc2.gotoAndStop(2);
} else if (_root.mc2._currentframe == 2) {
_root.mc2.gotoAndStop(1);
}
//
}
the problem still there. Any advice?
Thanks!
-
.
Hi,
That's because you are telling them both the same thing about each other, and I assume they are both on frame 1 at the beginning.
-
Originally Posted by fruitbeard
Hi,
That's because you are telling them both the same thing about each other, and I assume they are both on frame 1 at the beginning.
Hello,
Even if each mc was put on different layer, off course, on the 1st frame, still affecting each other.
-
.
Hi,
You would need to attach your *.fla and describe what it is you wish to happen as I am not on the same page with it.
-
Thank you fruitbeard for your time trying to help, that's great of you!
Problem solved!!!
Here is the code:
//With two movieClips(mc1, mc2) on stage(_root) on the 1st frame.
//this code attached to the 1st frame on stage.
_root.mc1.onRelease = clickMC;
_root.mc2.onRelease = clickMC;
//
function clickMC() {
trace("you clicked the "+this._name+" movie clip.");
if (this._currentframe == 1) {
this.gotoAndStop(2);
} else if (this._currentframe == 2) {
this.gotoAndStop(1);
}
}
Regards!
-
.
Hi,
You can also shorten that down slightly
PHP Code:
function clickMC() { trace("you clicked the " + this._name + " movie clip."); if (this._currentframe == 1) { this.gotoAndStop(2); } else { this.gotoAndStop(1); } }
I always knew that your onClipEvent (mouseDown) was never going to work the way you wanted it to.
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
|