4 Replies Latest reply on Mar 11, 2007 3:11 PM by kglad

    On Off Listener or Focus Problem

    W_Bell Level 1
      I have 2 buttons that turn on and off the same instances.
      1 Button turns my menu list on and off and the other button scales the image and turns part of the menu off (the header on top of myList).

      Now when I scale the image up the header goes off (correct)
      when I scale the image back down the header goes back on (correct)
      If the image is scaled up and I turn the menu of and on the header comes on (incorrect)
      I want the header to come on only if the image is not scaled up.

      Here's the code for Button 1:
      on (press) {
      _root.Cat._visible = false;
      _root.CatLab._visible = false;
      }

      Here's the code for Button 2:
      on (press) {
      setProperty("myPlayer", _x, "288.0");
      setProperty("myPlayer", _y, "279.0");
      setProperty("myPlayer", _xscale, "100");
      setProperty("myPlayer", _yscale, "100");
      _root.Cat._visible = true;
      _root.CatLab._visible = true;
      }


      Possibly I can make a Listener with myPlayer at a certain scale???

      Any help would be great!

      Thanks,

      Bisser.
        • 1. Re: On Off Listener or Focus Problem
          kglad Adobe Community Professional & MVP
          use an if-statement.
          • 2. Re: On Off Listener or Focus Problem
            W_Bell Level 1
            We here is my attempt at the if statement but it is not working and there is erros in the way I tried to write it. I made a button with instance called zoomsmall.
            Then I made 2 color boxes that are movies with instances Rbox and Gbox.
            The first 2 funtions work "if" does not work.


            zoomSmall.onPress=function(){
            setProperty("Rbox", _width, "300");
            setProperty("Rbox", _height, "300");
            }
            zoomSmall.onRelease = function() {
            setProperty("Rbox", _width, "200");
            setProperty("Rbox", _height, "200");
            }
            if ("Rbox", _width, "100") {
            setProperty("Gbox", _width, "300");
            setProperty("Gbox", _height, "300");
            } else {
            setProperty("Gbox", _width, "50");
            setProperty("Gbox", _height, "50");
            }
            • 3. Re: On Off Listener or Focus Problem
              W_Bell Level 1
              OK I got this code to work but I think it looks rather long.
              Is there a better way to structure the code?


              zoomSmall.onPress = function() {
              setProperty("Rbox", _width, "50");
              setProperty("Rbox", _height, "50");
              };
              zoomSmall.onRelease = function() {
              setProperty("Rbox", _width, "300");
              setProperty("Rbox", _height, "300");
              if (_root.Rbox._width == 300 and _root.Rbox._height == 300) {
              setProperty("Gbox", _width, "300");
              setProperty("Gbox", _height, "300");
              } else {
              setProperty("Gbox", _width, "50");
              setProperty("Gbox", _height, "50");
              }
              };
              • 4. Re: On Off Listener or Focus Problem
                kglad Adobe Community Professional & MVP
                if that code works for you, the following should work: