dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Visibility

  1. #1
    Senior Member
    Join Date
    Aug 2002
    Location
    LBV, Fl
    Posts
    102

    Visibility

    How can I make a button appear/dissappear without having to use
    _alpha=100/_alpha=0.
    I tried using _visible but it did not work. If I use alpha the button it still there and it can be used.
    Can anyone help?


    Thank
    Tom

  2. #2
    Lifesaver Lightwave Network's Avatar
    Join Date
    Sep 2002
    Location
    Denver, CO, USA
    Posts
    649
    You'll have to put your button into a movie clip. Just select your button and press F8, then select Movie Clip, click OK blah blah. Now your button is stored within the movie clip.

    Double-click on your new Movie Clip, and it will take you to the level of the button. There, select your button, and go to the ActionScript panel. You'll have to adjust some of your scripts, because they now reside in a child level. Use _parent in front of a lot of your scripts to refer to the previous level.

    Now, you can use _visible = false in your button's event scripts, and it will hide the movie clip that the button is contained in (hiding the button, too.)


    ... gimme just one more line of code to ease the pain.

    http://www.ln.tv
    http://www.davevillano.com
    http://www.premierloftsdenver.com
    http://www.backyard.cc -- coming soon!


  3. #3
    Senior Member
    Join Date
    Sep 2000
    Location
    Pittsburgh
    Posts
    252
    Hi,

    If you got alpha to work you should be able to get visible to work..
    test in a new movie, create two buttons, give them instance names of myButt1 and myButt2 and put this in the first frame...

    Code:
    myButt2.onRelease = function() {
    	if (myButt1._visible == 1) {
    		myButt1._visible = 0;
    	} else {
    		myButt1._visible = 1;
    	}
    };
    quick test fla below.

    Hope this helps,
    Dunc
    Attached Files Attached Files

  4. #4
    Official FK nice guy and MOD 3PRIMATES's Avatar
    Join Date
    Apr 2002
    Location
    Portland Oregon
    Posts
    1,645
    Hello,
    Lightwave is correct in some things, but you do not have to put your button in a movie clip.
    MX allows you to give MCs, buttons, and textfields an instance name.
    by targeting the instance name you can effect the appearance of the object you are targeting.

    Try this:
    Make a button and give it the instance name of myButton.

    Make a copy of the button on the stage and dont give it an instance name.

    Add this code to the button without the instance name:

    on(release){
    myButton._visible = false;
    }

    Same goes with movie clips, and textfields.. You should read up more on textfields because there is more to it than Im stating here.


    Hope it helps..
    3PRIMATES

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center