# \[Flash as 2\] visibility = help

**URL:** <https://forum.kirupa.com/t/flash-as-2-visibility-help/257328>\
**Category:** flash\
**Created:** [April 12, 2008, 7:28pm UTC](https://forum.kirupa.com/t/flash-as-2-visibility-help/257328 "2008-04-12T19:28:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![quincyhall187](https://avatars.discourse-cdn.com/v4/letter/q/51bf81/32.png) [@quincyhall187](https://forum.kirupa.com/u/quincyhall187)\
**Post date:** [April 12, 2008, 7:28pm UTC](https://forum.kirupa.com/t/flash-as-2-visibility-help/257328/1 "2008-04-12T19:28:06Z")

</div>

Sorta new to AS but I feel I’ve got a good question.

I have a swf file that has hotspots that will circle over an object over the course of 20 frames. I wanted to have a button that allows you to turn off/ on the the hotspots  
.  
see example swf here: [www.mediafire.com/?zszngdv5iiy](http://www.mediafire.com/?zszngdv5iiy)  
and flash file here: [www.mediafire.com/?onz1mwscdoi](http://www.mediafire.com/?onz1mwscdoi)

It’s almost working. The hide/show button does it’s job hiding the hotspots at first. However, when I use the slider the hotspots reappear. I’m guessing it’s because the hotspots that are reappearing were not actually present when the initial hide command was given. Does anybody have any idea of how I can govern these guys a little better?

(By the way I’m sure it’s not the slider code b/c I took it out and still had the same problem.)

My code (on the first frame followed my 19 more frames of hotspots):

stop();

//HIDE SHOW  
//When our buttons pressed:  
this.toggle\_btn.onRelease = function () {  
//check if its visible  
if (mirrors.\_visible == true) {  
//if it is make them invisible  
mirrors.\_visible = false;  
airports.\_visible = false;  
frontcowl.\_visible = false;  
instrumentpanel.\_visible = false;  
steeringdamper.\_visible = false;  
rearcowl.\_visible = false;  
frame.\_visible = false;  
engine.\_visible = false;  
frontbrake.\_visible = false;  
wheels.\_visible = false;  
assistslipperclutch.\_visible = false;  
sidestand.\_visible = false;  
swingarm.\_visible = false;  
exhaustsystem.\_visible = false;  
} else {  
//otherwise make them visible  
mirrors.\_visible = true;  
airports.\_visible = true;  
frontcowl.\_visible = true;  
instrumentpanel.\_visible = true;  
steeringdamper.\_visible = true;  
rearcowl.\_visible = true;  
frame.\_visible = true;  
engine.\_visible = true;  
frontbrake.\_visible = true;  
wheels.\_visible = true;  
assistslipperclutch.\_visible = true;  
sidestand.\_visible = true;  
swingarm.\_visible = true;  
exhaustsystem.\_visible = true;  
}  
};

////SLIDER

nob.\_x = slot.\_x;  
nob.\_y = slot.\_y;  
totalFrame = 20; // this must equal to the length of main timeline  
// If you control a timeline in a movieclip, a lot more easier

nob.onPress=function(){  
startDrag(nob,0,slot.\_x,slot.\_y,slot.\_width+slot.\_x-this.\_width,slot.\_y);  
// drag bound box is limited to the slot area  
// slot size & nob size could be scaled anytime without affecting the functionality at all  
// slot can be placed any where within the movie stage without affecting functionality  
}

nob.onRelease=function(){  
this.stopDrag();  
}

onEnterFrame=function(){  
fNum=int((nob.\_x-slot.\_x)/(slot.\_width-nob.\_width)\*(totalFrame))+1;  
trace(fNum);  
\_root.gotoAndStop(fNum);  
}
