3 Replies Latest reply on Apr 1, 2007 6:01 AM by abeall

    Tracking the visible property of a movie clip

    samebig
      Hello,

      I am trying to track the visible property of a movie clip as I need to perform a function when visible = true and another when visible =false

      I have tried to use a listener object but I can’t get it to work. Can you attach a listener object to listen for the visible property?

      I have also tried an IF statement inside the move clip but this only knows the state of the ._visible when it first runs.

      I have got it to work with an onEnterFrame function on a movie clip inside the one I want to know the property of but I don’t like using the onEnterFrame as it uses a lot or processor speed

      Is there an easy way to track the visible property of a movieclip???

      Thanks

      Sam.
        • 1. Re: Tracking the visible property of a movie clip
          abeall Level 3
          onEnterFrame isn't really a performance concern in this case, but it is icky.

          Try looking into the Object.watch() method. Unfortunately if I recall it doesn't work on getter/setter properties like _visible, but look into it.
          • 2. Re: Tracking the visible property of a movie clip
            samebig Level 1
            thanks for the help but the watch() method doesn't work for getter/setter properties. is ._visible a getter/setter property?

            I have tried the watch function and I couldn’t get it to work and i tried lots of variations including adding the visible property to a new object but that only stores the first value and doesn't update

            • 3. Re: Tracking the visible property of a movie clip
              abeall Level 3
              > thanks for the help but the watch() method doesn't work for getter/setter
              > properties. is ._visible a getter/setter property?

              I was afraid of that. Yes, _visible is a getter/setter, most properties are. Basically watch() only works on read-only properties and custom variables, which is a shame.

              So I don't know of any more elegant way than constantly checking to see if the value changed. Centralize it and maybe package it in a nice class and you might feel a little better about it...