Another newbie question that has me stuck badly.
I have three variables
var state1
var state2
var state3
I need to access one of them on a .click event depending on a property of the clicked object.
How do I access the correct variable? Basically I need to for the variable name by adding "state" and the correct number together.
I will update this post soon with some code in case it's needed.
var backstate1;
var backstate2;
var backstate3;
var currentFrame;
function hotspotHover(){
var currentElement = this;
var daName =this.name;
$("#hotspot" +daName).hover(
function() {
$("img.changeOutline").prop("src", currentElement.outlinesArray[currentFrame]);
$("#outlines").show();
},
function() {
$("#outlines").hide();
}
).click(function() {
var backstateLevelNumber = currentElement.backStateLevel; //not working
window['backstate'+ backstateLevelNumber]=currentFrame; //trying to set backstate+number to current frame variable
hoverClick(currentElement.defaultFrame);
checkReverse();
checkSeqLoop();
});
};
var state=[state1, state2, state3]and accessing them bystate[number]