For loop not working when added to function
Hi,
New here hopefully, this is in the right place.
I have several pop-ups on the stage called pop1-10. I need them to be hidden at run time.
When I try and achieve this using a for loop, it works fine.
for(i=1;this['pop'+i]!=undefined;i++)
{
this['pop'+i].visible=false;
console.log('pop'+i+' hidden');
}
When I try and put this in a function to use later on. It doesn't identify any of the 'pop' objects and leaves them visible.
function hPop()
{
for(var i=1;this['pop'+i]!=undefined;i++)
{
this['pop'+i].visible=false;
console.log('pop'+i+' hidden');
}
}
hPop();
Any ideas as to what I'm doing wrong? ![]()