Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

working with visibility on a button 3

Status
Not open for further replies.

TaiChi56

Technical User
Mar 6, 2002
188
0
0
US
I asked a similar question earlier and it was answered thank you. This one is a little different. Instead of two button, i have one. When I click on a button a blue arrow shows up. I want to click on the same button and the blue arrow goes away. My code is not working. Here it is.

on (release) {
es_arrow._visible=true;
}
on (release) {
es_arrow._visible=false;
}

es_arrow is the instance name for the arrow. Not trying to insult anyone's intelligence. Just making sure you make since of what I wrote. Probably is wrong. I can get it to light up but not go away on the second click. Hope this makes sense. Thank you guys. Love this forum. The secret in education lies in respecting the student. {Ralph Waldo Emerson}.
 
give the button an instance name, my_btn (say) and add this code to the main timeline

showArrow = true;
my_btn.onRelease()(
if (showArrow){
es_arrow._visible=false;
showArrow = false;
)else{
es_arrow._visible=true;
showArrow = true;
}
}
 
missed a bit


showArrow = true;
my_btn.onRelease = function(){
es_arrow._visible=false;
showArrow = false;
)else{
es_arrow._visible=true;
showArrow = true;
}
}



 
You can't use the on (release) like that because the second one wipes away the first: you can't have more than one on(event) for the same button.

This should work:

on (release)
{
es_arrow._visible=!es_arrow._visible;
}

Which basically is a toggle, whatever es_arrow._visible equals, you make it equal the opposite.
 
could I send one of you the fla to see what is wrong? Billwatson, the code does not like the else statement. BooYakaSha, your code kind of works. You would have to see it to understand it. Is it possible to send it to one of you to help. I would appreciate it. Let me know. Thank you. The secret in education lies in respecting the student. {Ralph Waldo Emerson}.
 
You can send it to me also! Hit my handle for my e-mail. Regards,

cubalibre2.gif
 
spotted my mistake

showArrow = true;
my_btn.onRelease = function(){
if(showarrow){
es_arrow._visible=false;
showArrow = false;
)else{
es_arrow._visible=true;
showArrow = true;
}
}
 
Just use what BooYaKaSha suggested on your buttons...

on (release) {
es_arrow._visible=!es_arrow._visible;
}

...On every button!


But also change all of your _alpha settings to _visible...

se_arrow._visible = 0;
ee_arrow._visible = 0;
eg_arrow._visible = 0;
gg_arrow._visible = 0;
gt_arrow._visible = 0;
tt_arrow._visible = 0;
te_arrow._visible = 0;
se_arrow._visible = 0;
gs_arrow._visible = 0;
st_arrow._visible = 0;
sg_arrow._visible = 0;
ts_arrow._visible = 0;
es_arrow._visible = 0;
ge_arrow._visible = 0;
et_arrow._visible = 0;
tg_arrow._visible = 0;



Regards,

cubalibre2.gif
 
Fantastic oldnewbie, with yours and BooYakaSha everything worked great.

Only one more thing I need to correct. When the graph comes up all arrows show blue. I have to click the reset button to start fresh. I would like the graph to come up blank then I can click on any button I want to the get the arrow, thus eliminating the reset button. The secret in education lies in respecting the student. {Ralph Waldo Emerson}.
 
...the graph comes up and all arrows show blue?

Not for me? Regards,

cubalibre2.gif
 
Then I must have screwed something up. I will check it and see if I can figure it out. Thanks. The secret in education lies in respecting the student. {Ralph Waldo Emerson}.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top