[RESOLVED] extra movies being attached on button click. Can't see the problem
Hi, I've been working for a while trying to fix my code and when I thought I had finally got something I find my buttons attach more clips than they're supposed to.
I hate posting a lot of code because it might seem irrelevant to other, but I need to do so because I have no clue of where the problem could be.
Here it is: it happens on attaching the exitHobb button which attaches extra clips on the top left corner of the swf.
http://web.sono.com/jpdurba for an example.
Code:
_root["subMenuButton" + 2].onPress = function():Void
{
CAT = ["FÃ*siques", "Futbol", "Tennis", "Pilota", "Cartes i jocs de taula", "Botifarra", "Backgammon", "Escacs", "Voluntariat", "Creu Roja", "Voluntari lingüÃ*stic", "Cartes al Director", "Avui", "El Periodico"];
SPA = ["FÃ*sicas", "Fútbol", "Tennis", "Pelota", "Cartas y juegos de mesa", "Botifarra", "Backgammon", "Ajedrez", "Voluntariado", "Cruz Roja", "Voluntario lingüÃ*stico", "Cartas al Director", "Avui", "El Periodico"];
ENG = ["Physical", "Football", "Tennis", "Pilota", "Card and Board games", "La Botifarra", "Backgammon", "Chess", "Volunteering", "Red Cross social events", "Catalan Linguistical Volunteer", "Press letters", "Avui", "El Periodico"];
hobbies_mc._visible = true;
for (i = 1; i <= 14; i++)
{
_root.attachMovie("HobbyTextButton" + i,"HobbyTextButton" + i,getNextHighestDepth());
_root["HobbyTextButton" + i]._x = _root.hobbies_mc["ref" + i]._x + 240;
_root["HobbyTextButton" + i]._y = _root.hobbies_mc["ref" + i]._y + 126;
if (_root.language == "catalan")
{
_root["HobbyTextButton" + i].Tex.text = CAT[i - 1];
}
else if (_root.language == "english")
{
_root["HobbyTextButton" + i].Tex.text = ENG[i - 1];
}
else if (_root.language == "spanish")
{
_root["HobbyTextButton" + i].Tex.text = SPA[i - 1];
}
_root.attachMovie("TimeExitButton","exitHobbButton_btn",getNextHighestDepth());
exitHobbButton_btn._x = hobbies_mc.exitHobbies_btn._x + 274;
exitHobbButton_btn._y = hobbies_mc.exitHobbies_btn._y + 126;
HobbyTextButton6.onRelease = function():Void
{
getURL("http://www.butinet.org", "_blank");
};
HobbyTextButton6.onRollOver = function():Void
{
_root.attachMovie("Buti_Img","Buti_Img",getNextHighestDepth());
Buti_Img._x = _root.hobbies_mc.ref6._x + 330;
Buti_Img._y = _root.hobbies_mc.ref6._y + 120;
};
HobbyTextButton6.onRollOut = function():Void
{
Buti_Img.removeMovieClip();
};
HobbyTextButton7.onRelease = function():Void
{
getURL("http://www.netgammon.com", "_blank");
};
HobbyTextButton13.onRollOver = function():Void
{
_root.attachMovie("avui_btn","avui_btn",getNextHighestDepth());
avui_btn._x = _root.hobbies_mc.ref13._x + 306;
avui_btn._y = _root.hobbies_mc.ref13._y + 126;
if (_root.language == "english")
{
_root.attachMovie("TradAvui_btn","TradAvui_btn",getNextHighestDepth());
TradAvui_btn._x = _root.hobbies_mc.ref13._x + 312;
TradAvui_btn._y = _root.hobbies_mc.ref13._y + 144;
}
periodico1_btn.removeMovieClip();
periodico2_btn.removeMovieClip();
periodico3_btn.removeMovieClip();
periodico4_btn.removeMovieClip();
avui_btn.Tex.text = "12/10/2012";
TradAvui_btn.Tex.text = "Translation";
avui_btn.onPress = function():Void
{
getURL("http://www.elpuntavui.cat/noticia/article/-/-/462641.html", "_blank");
};
TradAvui_btn.onPress = function():Void
{
_root.attachMovie("tradAvui_mc","tradAvui_mc",getNextHighestDepth());
tradAvui_mc._x = 400;
tradAvui_mc._y = 240;
tradAvui_mc.onPress = function()
{
startDrag(this);
};
tradAvui_mc.onRelease = function()
{
stopDrag();
_root.attachMovie("TimeExitButton","exitTradAvui_btn",_root.getNextHighestDepth());
exitTradAvui_btn._x = _root.tradAvui_mc._x + 566;
exitTradAvui_btn._y = _root.tradAvui_mc._y + 5;
exitTradAvui_btn.onPress = function():Void
{
tradAvui_mc.swapDepths(0);
tradAvui_mc.removeMovieClip();
exitTradAvui_btn.swapDepths(0);
exitTradAvui_btn.removeMovieClip();
_root["subMenuButton" + 13].enabled = true;
};
};
};
};
var dates:Array = ["01/07/2013", "03/07/2013", "26/07/2013", "28/09/2013"];
HobbyTextButton14.onRollOver = function():Void
{
for (j = 1; j <= 4; j++)
{
_root.attachMovie("periodico" + j + "_btn","periodico" + j + "_btn",getNextHighestDepth());
_root["periodico" + j + "_btn"]._x = _root.hobbies_mc.ref14._x + 306;
//_root["periodico" + j + "_btn"]._y = _root.hobbies_mc.ref14._y + 120+(22*i);
_root["periodico" + j + "_btn"].Tex.text = dates[j - 1];
avui_btn.removeMovieClip();
TradAvui_btn.removeMovieClip();
}
periodico1_btn._y = _root.hobbies_mc.ref13._y + 126;
periodico2_btn._y = _root.hobbies_mc.ref13._y + 144;
periodico3_btn._y = _root.hobbies_mc.ref13._y + 162;
periodico4_btn._y = _root.hobbies_mc.ref13._y + 180;
periodico1_btn.onRelease = function():Void
{
getURL("http://www.elperiodico.cat/ca/cartas/entre-tots/vehicles-amb-xofer-conveni-sense-aplicar/77926.shtml", "_blank");
};
periodico2_btn.onRelease = function():Void
{
getURL("http://www.elperiodico.cat/ca/cartas/entre-tots/tv-3-gran-dictat/78524.shtml", "_blank");
};
periodico3_btn.onRelease = function():Void
{
getURL("http://www.elperiodico.cat/ca/cartas/entre-tots/seguretat-viaria-hem-millorar-formacio/80548.shtml", "_blank");
};
periodico4_btn.onRelease = function():Void
{
getURL("http://www.elperiodico.cat/ca/cartas/entre-tots/porto-passaport-sobre-pero-per-raons-molt-diferents-les-sanchez-camacho/85704.shtml", "_blank");
};
};
exitHobbButton_btn.onRelease = function()
{
hobbies_mc._visible = false;
Buti_Img.removeMovieClip();
tradAvui_mc.removeMovieClip();
exitTradAvui_btn.removeMovieClip();
periodico1btn.removeMovieClip();
periodico2_btn.removeMovieClip();
periodico3_btn.removeMovieClip();
periodico4_btn.removeMovieClip();
exitHobbButton_btn.removeMovieClip();
for (i = 1; i <= 14; i++)
{
_root["HobbyTextButton" + i].removeMovieClip();
_root["subMenuButton" + 2].enabled = true;
}
};
}
_root.hobbies_mc.onRollOut = function()
{
avui_btn.removeMovieClip();
TradAvui_btn.removeMovieClip();
periodico1_btn.removeMovieClip();
periodico2_btn.removeMovieClip();
periodico3_btn.removeMovieClip();
periodico4_btn.removeMovieClip();
};
};