I’ve run into a problem that’s driving me crazy. I’d really appreciate it if someone could take a look at this and help me out.
You can see a working example of the file at: http://www.benekdesign.com/ILRE/map.php
Here is the problem:
First, click on the Abaco island shape on the map. You’ll see on rollOver there is a glow around the island. Now click on that island and the glow remains for the zoomed-in detailed view. When you return to map and zoom back out, the glow is removed.
Now, compare this with clicking on the island name “Abaco” from the list on the right, instead of clicking directly on the island from the map. It zooms in and shows the details fine, but the glow that should be there is not.
The reason this problem is very perplexing for me, is that the onPress action of the list button in the right column calls the onPress function of the map button. So, theoretically they should do the EXACT same thing when pushed. But clearly they don’t.
Here is the code for the button from the list on the right panel:
listAbaco_mc.onRollOver = function() {
_root.map_mc.abaco_mc.button_btn.onRollOver();
};
listAbaco_mc.onRollOut = function() {
_root.map_mc.abaco_mc.button_btn.onRollOut();
};
**listAbaco_mc.onPress = function() {
[COLOR=Red] _root.map_mc.abaco_mc.button_btn.onPress();[/COLOR]
};**
And here is the related code from the root that includes the onPress referenced above plus all functions called as a result of that (some areas to note are bolded):
//++++++++++++++++++++++++++++++++++++++++++++++
// functions
//++++++++++++++++++++++++++++++++++++++++++++++
// function to open/close side menu
openPanel = function (island) {
panel_mc.alphaTo(20, .001, "linear", 1.4, function () {
panel_mc.gotoAndStop(island);
});
panel_mc.xSlideTo(603, .7, "easeOutQuint", 1.5);
panel_mc.alphaTo(100, .7, "easeOutQuad", 1.5);
};
closePanel = function () {
panel_mc.xSlideTo(925, .7, "easeInQuint", 0);
panel_mc.alphaTo(20, .7, "easeInQuad", 0);
};
// function to fade out unselected islands on zoom
fadeIslands = function (alpha, mapPath) {
map_mc.extraIslands_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.abaco_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.acklins_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.andros_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.bimini_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.berry_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.cat_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.crooked_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.eleuthera_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.exuma_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.grand_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.inagua_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.long_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.mayaguana_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.np_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.rumcay_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.sansalvador_mc.alphaTo(alpha, 1, "linear", .3);
if (alpha < 100) {
mapPath.alphaTo(100, 1, "linear", .3);
}
};
// function to fade labels on zoom
fadeLabels = function (alpha, delay) {
map_mc.labels_mc.alphaTo(alpha, .5, "linear", delay);
if (alpha == 100) {
map_mc.labels_mc.abacoLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.acklinsLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.androsLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.biminiLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.berryLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.catLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.crookedLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.eleutheraLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.exumaLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.grandLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.inaguaLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.longLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.mayaguanaLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.nassauLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.npLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.rumcayLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.sansalvadorLabel_mc._alpha = labelAlpha;
}
};
// disable island buttons when zoomed in
disableButtons = function () {
map_mc.abaco_mc.button_btn.enabled = false;
map_mc.acklins_mc.button_btn.enabled = false;
map_mc.andros_mc.button_btn.enabled = false;
map_mc.bimini_mc.button_btn.enabled = false;
map_mc.berry_mc.button_btn.enabled = false;
map_mc.cat_mc.button_btn.enabled = false;
map_mc.crooked_mc.button_btn.enabled = false;
map_mc.eleuthera_mc.button_btn.enabled = false;
map_mc.exuma_mc.button_btn.enabled = false;
map_mc.grand_mc.button_btn.enabled = false;
map_mc.inagua_mc.button_btn.enabled = false;
map_mc.long_mc.button_btn.enabled = false;
map_mc.mayaguana_mc.button_btn.enabled = false;
map_mc.nassau_mc.button_btn.enabled = false;
map_mc.np_mc.button_btn.enabled = false;
map_mc.rumcay_mc.button_btn.enabled = false;
map_mc.sansalvador_mc.button_btn.enabled = false;
};
enableButtons = function () {
map_mc.abaco_mc.button_btn.enabled = true;
map_mc.acklins_mc.button_btn.enabled = true;
map_mc.andros_mc.button_btn.enabled = true;
map_mc.bimini_mc.button_btn.enabled = true;
map_mc.berry_mc.button_btn.enabled = true;
map_mc.cat_mc.button_btn.enabled = true;
map_mc.crooked_mc.button_btn.enabled = true;
map_mc.eleuthera_mc.button_btn.enabled = true;
map_mc.exuma_mc.button_btn.enabled = true;
map_mc.grand_mc.button_btn.enabled = true;
map_mc.inagua_mc.button_btn.enabled = true;
map_mc.long_mc.button_btn.enabled = true;
map_mc.mayaguana_mc.button_btn.enabled = true;
map_mc.nassau_mc.button_btn.enabled = true;
map_mc.np_mc.button_btn.enabled = true;
map_mc.rumcay_mc.button_btn.enabled = true;
map_mc.sansalvador_mc.button_btn.enabled = true;
};
// function to zoom into map
**zoomIsland = function (island) {
// set some vars depending on which island to zoom to
switch (island) {
case "abaco" :
_root.accomLink = _root.abaco[0];
_root.direcLink = _root.abaco[1];
_root.activLink = _root.abaco[2];
_root.propLink = _root.abaco[3];
mapX = 650;
mapY = 750;
mapScale = 300;
mapPath = _root.map_mc[island + "_mc"];
break;**
case "acklins" :
_root.accomLink = _root.acklins[0];
_root.direcLink = _root.acklins[1];
_root.activLink = _root.acklins[2];
_root.propLink = _root.acklins[3];
mapX = -420;
mapY = -490;
mapScale = 500;
mapPath = _root.map_mc[island + "_mc"];
break;
case "andros" :
_root.accomLink = _root.andros[0];
_root.direcLink = _root.andros[1];
_root.activLink = _root.andros[2];
_root.propLink = _root.andros[3];
mapX = 675;
mapY = 250;
mapScale = 225;
mapPath = _root.map_mc[island + "_mc"];
break;
case "berry" :
_root.accomLink = _root.berry[0];
_root.direcLink = _root.berry[1];
_root.activLink = _root.berry[2];
_root.propLink = _root.berry[3];
mapX = 1235;
mapY = 1025;
mapScale = 700;
mapPath = _root.map_mc[island + "_mc"];
break;
case "bimini" :
_root.accomLink = _root.bimini[0];
_root.direcLink = _root.bimini[1];
_root.activLink = _root.bimini[2];
_root.propLink = _root.bimini[3];
mapX = 2450;
mapY = 1315;
mapScale = 900;
mapPath = _root.map_mc[island + "_mc"];
break;
case "cat" :
_root.accomLink = _root.cat[0];
_root.direcLink = _root.cat[1];
_root.activLink = _root.cat[2];
_root.propLink = _root.cat[3];
mapX = 150;
mapY = 300;
mapScale = 500;
mapPath = _root.map_mc[island + "_mc"];
break;
case "crooked" :
_root.accomLink = _root.crooked[0];
_root.direcLink = _root.crooked[1];
_root.activLink = _root.crooked[2];
_root.propLink = _root.crooked[3];
mapX = -650;
mapY = -620;
mapScale = 700;
mapPath = _root.map_mc[island + "_mc"];
break;
case "eleuthera" :
_root.accomLink = _root.eleuthera[0];
_root.direcLink = _root.eleuthera[1];
_root.activLink = _root.eleuthera[2];
_root.propLink = _root.eleuthera[3];
mapX = 470;
mapY = 470;
mapScale = 350;
mapPath = _root.map_mc[island + "_mc"];
break;
case "exuma" :
_root.accomLink = _root.exuma[0];
_root.direcLink = _root.exuma[1];
_root.activLink = _root.exuma[2];
_root.propLink = _root.exuma[3];
mapX = 400;
mapY = 190;
mapScale = 275;
mapPath = _root.map_mc[island + "_mc"];
break;
case "grand" :
_root.accomLink = _root.grand[0];
_root.direcLink = _root.grand[1];
_root.activLink = _root.grand[2];
_root.propLink = _root.grand[3];
mapX = 1030;
mapY = 1000;
mapScale = 400;
mapPath = _root.map_mc[island + "_mc"];
break;
case "inagua" :
_root.accomLink = _root.inagua[0];
_root.direcLink = _root.inagua[1];
_root.activLink = _root.inagua[2];
_root.propLink = _root.inagua[3];
mapX = -470;
mapY = -750;
mapScale = 400;
mapPath = _root.map_mc[island + "_mc"];
break;
case "long" :
_root.accomLink = _root.long[0];
_root.direcLink = _root.long[1];
_root.activLink = _root.long[2];
_root.propLink = _root.long[3];
mapX = 80;
mapY = -80;
mapScale = 400;
mapPath = _root.map_mc[island + "_mc"];
break;
case "mayaguana" :
_root.accomLink = _root.mayaguana[0];
_root.direcLink = _root.mayaguana[1];
_root.activLink = _root.mayaguana[2];
_root.propLink = _root.mayaguana[3];
mapX = -1320;
mapY = -770;
mapScale = 700;
mapPath = _root.map_mc[island + "_mc"];
break;
case "np" :
_root.accomLink = _root.np[0];
_root.direcLink = _root.np[1];
_root.activLink = _root.np[2];
_root.propLink = _root.np[3];
mapX = 1250;
mapY = 900;
mapScale = 999;
mapPath = _root.map_mc[island + "_mc"];
break;
case "rumcay" :
_root.accomLink = _root.rumcay[0];
_root.direcLink = _root.rumcay[1];
_root.activLink = _root.rumcay[2];
_root.propLink = _root.rumcay[3];
mapX = -580;
mapY = -160;
mapScale = 999;
mapPath = _root.map_mc[island + "_mc"];
break;
case "sansalvador" :
_root.accomLink = _root.sansalvador[0];
_root.direcLink = _root.sansalvador[1];
_root.activLink = _root.sansalvador[2];
_root.propLink = _root.sansalvador[3];
mapX = -850;
mapY = 140;
mapScale = 999;
mapPath = _root.map_mc[island + "_mc"];
break;
default :
//nothing
}
** // begin the rest of the function
// hide stuff before zoom
closePanel();
compass_mc.alphaTo(0, .7, "easeOutQuad", 0, function () {
compass_mc._visible = false;
});
bahamas_mc.alphaTo(0, .7, "easeOutQuad", 0, function () {
bahamas_mc._visible = false;
});
introText_mc.alphaTo(0, .7, "easeOutQuad", 0, function () {
introText_mc._visible = false;
});
// move map
map_mc.scaleTo(mapScale, 1, "easeInOutQuad", .3);
map_mc.xSlideTo(mapX, 1, "easeInOutQuad", .3);
map_mc.ySlideTo(mapY, 1, "easeInOutQuad", .3);
// fade islands and labels
fadeIslands(15, mapPath);
fadeLabels(0, 0);
disableButtons();
// re-open panel
openPanel(island);
// show return button
return_mc.back_btn.enabled = true;
return_mc.gotoAndStop(island);
return_mc.alphaTo(100, 1, "easeOutQuad", 2);
// show towns, dots and glow
mapPath.maskDot_mc.ySlideTo(0, 1, "easeOutQuad", 2);
[COLOR=Red]mapPath.land_mc.glowTo(0x084d86, .5, 8, 1, 2, false, false, .5, "easeOutQuad", .5);[/COLOR]
};**
// function to return to map
returnMap = function () {
// hide stuff for zoom out
closePanel();
fadeIslands(100);
fadeLabels(100, 1.3);
return_mc.back_btn.enabled = false;
return_mc.alphaTo(0, .7, "easeOutQuad", 0);
// move map
map_mc.scaleTo(_root.initialScale, 1, "easeInOutQuad", .3, enableButtons);
map_mc.xSlideTo(_root.initialX, 1, "easeInOutQuad", .3);
map_mc.ySlideTo(_root.initialY, 1, "easeInOutQuad", .3);
// re-open panel and show extras
openPanel("start");
compass_mc._visible = true;
bahamas_mc._visible = true;
introText_mc._visible = true;
compass_mc._alpha = 0;
bahamas_mc._alpha = 0;
introText_mc._alpha = 0;
compass_mc.alphaTo(100, 1, "easeOutQuad", 1.5);
bahamas_mc.alphaTo(100, 1, "easeOutQuad", 1.8);
introText_mc.alphaTo(100, 1, "easeOutQuad", 2.1);
// hide towns, dots and glow
mapPath.maskDot_mc.ySlideTo(-150, .7, "easeOutQuad", 0);
mapPath.land_mc.glowTo(0x084d86, 0, 3, 0, 2, false, false, 2, "easeOutQuad", .3);
};
//++++++++++++++++++++++++++++++++++++++++++++++
// fade in on start
//++++++++++++++++++++++++++++++++++++++++++++++
water_mc.alphaTo(100, 1, "easeOutQuad", 0);
compass_mc.alphaTo(100, 1, "easeOutQuad", .5);
bahamas_mc.alphaTo(100, 1, "easeOutQuad", .8);
introText_mc.alphaTo(100, 1, "easeOutQuad", 1.1);
map_mc.alphaTo(100, 2, "easeOutQuad", 1);
openPanel("start");
//++++++++++++++++++++++++++++++++++++++++++++++
// check for querystring and load island
//++++++++++++++++++++++++++++++++++++++++++++++
this.onEnterFrame = function() {
if (_root.startIsland != "" && _root.startIsland != undefined && _root.startIsland != "map") {
map_mc[_root.startIsland + "_mc"].button_btn.onPress();
}
delete this.onEnterFrame;
};
//++++++++++++++++++++++++++++++++++++++++++++++
// island buttons
//++++++++++++++++++++++++++++++++++++++++++++++
// abaco
map_mc.abaco_mc.button_btn.onRollOver = function() {
this._parent.land_mc.shape_mc.colorTo(0xffffff, .3, "easeOutQuad", 0);
this._parent.land_mc.glowTo(0x084d86, 1, 3, 1, 2, false, false, .3, "easeOutQuad", 0);
this._parent._parent.labels_mc.abacoLabel_mc.alphaTo(100, .3, "easeOutQuad");
panel_mc.listAbaco_mc.colorTo(0x000000, .3, "easeOutQuad", 0);
panel_mc.leaf2_mc.alphaTo(100, .3, "easeOutQuad", .2);
panel_mc.leaf2_mc.ySlideTo(panel_mc.listAbaco_mc._y, .3, "easeOutQuad", 0);
};
map_mc.abaco_mc.button_btn.onRollOut = function() {
this._parent.land_mc.shape_mc.colorTo(0xd8eefb, .3, "easeOutQuad", 0);
this._parent.land_mc.glowTo(0x084d86, 1, 5, 0, 2, false, false, .3, "easeOutQuad", 0);
this._parent._parent.labels_mc.abacoLabel_mc.alphaTo(labelAlpha, .3, "easeOutQuad");
panel_mc.listAbaco_mc.colorTo(0x0d4a88, .3, "easeOutQuad", 0);
panel_mc.leaf2_mc.alphaTo(0, .3, "easeOutQuad", .2);
};
**map_mc.abaco_mc.button_btn.onPress = function() {
zoomIsland("abaco");
this._parent.land_mc.shape_mc.colorTo(0xd8eefb, .3, "easeOutQuad", 0);
};**
There is more code, for example rollOver, rollOut, and Press actions for the other island buttons, but they are all of the exact same format as the Abaco island button and they all have the same problem.
So, to recap, the problem is that the list button in the right panel do not function properly onPress, even though they are calling the onPress function of the island buttons directly, and the island button onPress function works perfectly. Strangely, all but one little thing works. So it’s obviously getting to the correct functions and going through the code as planned, yet that one part about the glow is being ignored or otherwise messed up.
I’m pulling out my hair on this one and I’d really appreciate some guidance. This project is nearly done except for this one setback.
Thanks kindly in advance for help.
Cheers,
Benek