Problems with an array (attachMovie)
I've created a 20 x 20 grid of objects (openCircles). They're set to 'alpha = 0', then 'alpha = 100' on rollover. This works for all of them except for the final one at the coordinate T,20 in the bottom right corner, as I'm not able to rollover over it. To test whether or not they all existed, I set them all to an initial value of 'alpha = 100' and they did all appear, but I'm still unable to rollover the one at T20.
The other problem is that when an 'openCircle' is clicked, a 'filledCircle' (set up as another grid of invisible objects in the same place) is supposed to appear in its place. That doesn't happen. All of the objects are created and exist, using attachMovie, so it's maybe due to some logical error. See code:-
I'd be grateful for any help. Many thanks.
stop();
//The purpose of this experiment is to locate a trap of oil. Only 30 exploration holes are allowed.
//Use the grid coordinate to locate the borehole and then plot the depth
//Drilled is set to false in the 1st(previous) frame
//Rolling over a grid coordinate will reveal a borehole (open circle).
//Click on the borehole (open circle) to start drilling
//open circle will be removed
//drilled is set to true for that coordinate
//filled circle will appear in its place
//set up variables for grid array of open circles (undrilled) and closed circles (drilled)
var spacing:Number = 5.75;
var cols:Number = 20; // number of columns in grid
var rows:Number = 20; // number of rows in grid
var leftMargin:Number = 154;
var topMargin:Number = 169;
var currentRow:Number = 0;
var currentCol:Number = 0;
for (i=1; i<=rows; i++) {
for (j=1; j<=cols; j++) {
current = attachMovie("openCircle_mc", "openCircle_mc"+i+"_"+j,getNextHighestDepth());
current._x = leftMargin + ((i-1) * (spacing + current._width));
current._y = topMargin + ((j-1) * (spacing + current._height));
current2 = attachMovie("filledCircle_mc", "filledCircle_mc"+i+"_"+j, getNextHighestDepth());
current2._x = leftMargin + ((i-1) * (spacing + current2._width));
current2._y = topMargin + ((j-1) * (spacing + current2._height));
//open circle initially invisible, then visible on rollOver
current._alpha = 0;
//filled circles initially invisible
currentCol2=(current2._x-leftMargin)/(spacing + current2._width);
currentRow2=(current2._y-topMargin)/(spacing + current2._height);
if (drilled[currentCol,currentRow]==true){
current2._alpha = 100;
}else{
current2._alpha=0;
}
//open circle visible on rollover
current.onRollOver = function() {
this._alpha = 100;
currentCol=(this._x-leftMargin)/(spacing + current._width);
trace("current column ="+currentCol);
currentRow=(this._y-topMargin)/(spacing + current._height);
trace("current row ="+currentRow);
if (drilled[currentCol,currentRow]==false){
trace("Click on the grid point to drill at "+rowLabel[currentRow]+","+colLabel[currentCol]);
}else{
trace("Click on the grid point to review the core at "+rowLabel[currentRow]+","+colLabel[currentCol]);
} //end 'if-else'
}
//open circle invisible on rollout
current.onRollOut = function() {
this._alpha = 0;
trace("No grid point selected")
}
//click on open circle - variable drilled becomes true
current.onRelease=function(){
drilled[currentCol,currentRow]=true;
trace(drilled[currentCol,currentRow]);
this.removeMovieClip();
}
}
}
This is an image of the grid showing an 'openCircle' visible when rolled over

