• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Hide/Show symbols or set alpha to 0%

New Here ,
May 19, 2008 May 19, 2008

Copy link to clipboard

Copied

I have a simple program which has everything shown on several layers but in just one frame. I was wondering if there was a way to have a button make a symbol hidden or shown without changing frames. Also I think setting the alpha to zero would work for me. I use this code to change the color of a symbol and I'm looking for something similar:

on (release)
{
colorchange = new Color("/ball");
colorchange.setRGB(0x0000FF);
}

"ball" being the name of my movie clip in this instance...
TOPICS
ActionScript

Views

514

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 19, 2008 May 19, 2008

Copy link to clipboard

Copied

depnding on where ball is...

ball._visible = false;

will make it disappear as long as it is a movieclip or button instance. Setting it to true will make it reappear.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 19, 2008 May 19, 2008

Copy link to clipboard

Copied

Awesome thank you. One more thing... Can I make the same button make it both visible and hidden.

i.e. Click the button to show - Click the button again to hide.

how would I set that code up?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 19, 2008 May 19, 2008

Copy link to clipboard

Copied

The difference between alpha = 0 and visible = 0 is that buttons are still active with alpha 0. If you set the button's visibility to zero, you won't be able to click on it and will have to restore its visibility by some other action.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 20, 2008 May 20, 2008

Copy link to clipboard

Copied

You can switch between the two states with the same button using an if/else conditional:

if(ball._visible){
ball._visible = false;
} else {
ball._visible = true;
}

You can use _alpha = 0 versus _alpha = 100 in place of changing the _visible property.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 20, 2008 May 20, 2008

Copy link to clipboard

Copied

Thanks for all the help. I think I got it now.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 20, 2008 May 20, 2008

Copy link to clipboard

Copied

if(ball._visible){
ball._visible = false;
} else {
ball._visible = true;
}

The easier way to switch states is

ball._visible = !ball._visible;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 21, 2008 May 21, 2008

Copy link to clipboard

Copied

LATEST
Thanks for that one!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines