movieclips, buttons and arrays - oh the joys
I am having such an issue working with arrays, im not great at fpash but decided to try a different approach to writing out the same functions for different buttons over and over again.
The plan is meant to be:
6 movieclip buttons on stage (markers) and 6 movieclip boxes on stage (panels). click a marker and it plays the fade in animation within the panel.
access/call the close button.onRelease function; location within the animated movieclip of the original panel movieclip (p1.p1_an.close_btn) to then call rewindframes(); to fade out the panel back to square one again.
repeat for all 6 buttons and clips.
Here is my code. i know its probably got something to do with strings and converting values to objects etc but i have tried so many things i just cannot get it to work.
please help ![]()
stop();
var myMarker = new Array (marker1, marker2, marker3, marker4, marker5, marker6);
var myPanel = new Array(p1, p2, p3, p4, p5, p6);
//***************************//
// Markers buttons
//***************************//
for (var i = 1; i < myMarker.length; i++)
{
myMarker.onRelease = function()
{
play();//fadeout markers
playPanel(myPanel); // play panel 1 to 6 depending on marker clicked
this[myPanel + "." myPanel + "_an"].close_btn.onRelease = function() //location of close button example - p1.p1_an.close_btn
{
rewindFrames(myPanel); // function to rewind frames of panel fade in animation back to frame 0;
};
};
}
//***************************//
// Play Panel
//***************************//
function playPanel(panelName)
{
panelName.play();
}
//***************************//
// Rewind Panel
//***************************//
function rewindFrames(panelName)
{
panelName.onEnterFrame = function()
{
if (panelName._currentframe != 1)
{
panelName.prevFrame();
}
else
{
panelName.stop();
delete this["onEnterFrame"];
}
};
}
//***************************//
// Fade in Markers
//***************************//
function fadeInMarkers()
{
onEnterFrame = function ()
{
if (_currentframe != 30)
{
prevFrame();
}
else
{
stop();
delete this["onEnterFrame"];
}
};
}