Exuk
August 9, 2004, 5:43am
1
I have some code that is canceling out my other code. I have code that is controlling two movie clips. Below i have the code separated in two sections, marked my comments. When i add the second sections “//info box”, it disables the code above it. I know the code works, because i have it working separatly. Can anyone tell me what the conflict is?
//contact box
_root.onEnterFrame = function() {
if (contact == "yes") {
_root.anim1._x += (150-_root.anim1._x)/4;
_root.anim1._y += (125-_root.anim1._y)/4;
}
if (contact == "close") {
_root.anim1._x += (200-_root.anim1._x)/4;
_root.anim1._y += (-200-_root.anim1._y)/4;
}
if (_root.anim1._x == 150) {
contact = "";
}
};
_root.contactButton.onRelease = function() {
contact = "yes";
};
_root.anim1.contactBox_mc.closeButton.onRelease = function() {
contact = "close";
};
//info box
_root.onEnterFrame = function() {
if (info == "yes") {
_root.anim2._x += (250-_root.anim2._x)/4;
_root.anim2._y += (225-_root.anim2._y)/4;
}
if (info == "close") {
_root.anim2._x += (200-_root.anim2._x)/4;
_root.anim2._y += (-200-_root.anim2._y)/4;
}
if (_root.anim2._x == 150) {
info = "";
}
};
_root.infoButton.onRelease = function() {
info = "yes";
};
_root.anim2.infoBox_mc.closeButton2.onRelease = function() {
info = "close";
};
system
August 9, 2004, 7:04am
2
You overwrite the _root.onEnterFrame, try this (I left the code for the buttons out)
//contact box
_root.anim1.onEnterFrame = function() {trace(contact)
if (contact == "yes") {
this._x += (150-this._x)/4;
this._y += (125-this._y)/4;
}
if (contact == "close") {
this._x += (200-this._x)/4;
this._y += (-200-this._y)/4;
}
if (this._x == 150) {
contact = "";
}
};
//info box
_root.anim2.onEnterFrame = function() {
if (info == "yes") {
this._x += (250-this._x)/4;
this._y += (225-this._y)/4;
}
if (info == "close") {
this._x += (200-this._x)/4;
this._y += (-200-this._y)/4;
}
if (this._x == 150) {
info = "";
}
};
scotty(-:
system
August 10, 2004, 1:22am
3
I modified the code and it still not working. There must be some conflict. I have upload my .fla, maybe that will help. The action script is in the first frame of the actions layer.
system
August 10, 2004, 1:24am
4
system
August 10, 2004, 1:32am
5
Here is the code
//contact box
root.anim1.onEnterFrame = function() {trace(contact)
if (contact == "yes") {
this._x += (150-this._x)/4;
this._y += (125-this._y)/4;
}
if (contact == "close") {
this._x += (200-this._x)/4;
this._y += (-200-this._y)/4;
}
if (this._x == 150) {
contact = "";
}
};
_root.contactButton.onRelease = function() {
contact = "yes";
};
_root.anim1.contactBox_mc.closeButton.onRelease = function() {
contact = "close";
};
//info box
_root.anim2.onEnterFrame = function() {
if (info == "yes") {
this._x += (250-this._x)/4;
this._y += (225-this._y)/4;
}
if (info == "close") {
this._x += (200-this._x)/4;
this._y += (-200-this._y)/4;
}
if (this._x == 150) {
info = "";
}
};
_root.infoButton.onRelease = function() {
info = "yes";
};
_root.anim2.infoBox_mc.closeButton2.onRelease = function() {
info = "close";
};
system
August 10, 2004, 5:31am
6
Your link isn’t working:stunned:
scotty(-: