2 Replies Latest reply on Jan 6, 2010 6:34 PM by TWite35

    _visible doesn't work but _alpha does

    TWite35

      Hi,

       

      I'm using AS2 (Flash 8), and I created a subclass of MovieClip - Card and attached an instance to the stage using attachMovie. However, I can't seem to make it invisible using _visible. Using _alpha works, however, but I would like to use _visible instead. Any ideas where the problem might be? Here's the relevant code:

       

      display_card = attachMovie("card", "displaycard", 99999, {_x:0, _y:0}).init("display", "card_nasty_bug.jpg");
              display_card._xscale = display_card._yscale = 60;
              display_card._visible = false;     //doesn't work
              display_card._alpha = 50;          //works

       

      Here's the init function for my Card class:

       

          function init (type:String, pic:String){
              type = type;
              pic = pic;
              this.loadMovie(pic);
                     
              this._xscale = this._yscale = scale;
              return this;
          }

       

      One more thing, what are the events for when the mouse cursor enters or leaves a MovieClip? I've tried onRollOver and onRollOut, but those are apparently not the correct events...

       

      Thanks.

        • 1. Re: _visible doesn't work but _alpha does
          Rothrock Level 5

          My guess is that it actually is working. However when you loadMovie some things are going to be reset when the contents finish loading.

           

          What you should probably do is add a line like this inside your class:

           

              function init (type:String, pic:String){

                    var artwork:MovieClip=this.createEmptyMovieClip("artwork",1000);
                  type = type;
                  pic = pic;
                  artwork.loadMovie(pic);
                  return this;
              }

           

          That way your content will be loaded into the child movieclip, but you can control the visibility and event handlers (which you do have the right ones by the way) by attaching them to the parent. Event handlers too are cleared when content is loaded.

           

          BTW, you should generally not use loadMovie because it doesn't have easy ways to know when it is done or to track its progress. You should look into the MovieClipLoader class because it provides nice events for those important things

          • 2. Re: _visible doesn't work but _alpha does
            TWite35 Level 1

            You were absolutely right on both counts (visibility and the events - for the events it turned out that I assigned the events in the wrong way...)

             

            Thank you very much!