4 Replies Latest reply on Jan 28, 2008 8:33 PM by PremierPTS

    Flash button action

    PremierPTS
      Greetings flashers: I'm just starting to get into flash and I'm trying to understand an action for a button. The button action script is:

      on (rollOver) {
      if (_root.link<>4) {
      this.gotoAndPlay("s1");
      }
      }
      on (releaseOutside, rollOut) {
      if (_root.link<>4) {
      this.gotoAndPlay("s2");
      }
      }
      on (release) {
      if (_root.link<>4) {
      _root["item"+_root.link].gotoAndPlay("s2");
      _root.link = 4;
      }
      }
      on (release) {
      getURL("index-4.html");
      }

      I get the rollover (self explanatory) the releaseoutside, rollout ( click outside is treated as rollout?)

      My question is Why the 2 release sections? I'll have a followup to this once I can follow the logic of your answers.
      Pardon my ettiquette if I've done something wrong in asking.

      Thanks group.
        • 1. Re: Flash button action
          sneakyimp Level 2
          It's your code, you tell us why you put them both in there? I'm not certain, but I think that second on(release) function will *replace* the first one entirely. try putting a trace statement in each one to see if they both actually run.
          • 2. Re: Flash button action
            PremierPTS Level 1
            Maybe though it should have occurred to you that it's not my code, before you offer something as witty as "It's your code, you tell us why you put them both in there". Do you really think I'd ask a question to test your voluminous knowledge of flash?

            I'll look into the trace. Thank you for that part.
            • 3. Re: Flash button action
              funkysoul Level 4
              To be honest, it looks pretty weird to me and it's not logical at all using 2 onRelease actions on the same button, you can consolidate it by using your code like this:

              on (rollOver) {
              if (_root.link<>4) {
              this.gotoAndPlay("s1");
              }
              }
              on (releaseOutside, rollOut) {
              if (_root.link<>4) {
              this.gotoAndPlay("s2");
              }
              }
              on (release) {
              if (_root.link<>4) {
              _root["item"+_root.link].gotoAndPlay("s2");
              _root.link = 4;
              } else {
              getURL("index-4.html");
              }
              • 4. Re: Flash button action
                PremierPTS Level 1
                Thanks Funkysoul. I didn't quite understand it either. When I first looked at it, I thought it would be a dual action type button. One thing on the first click, the second thing on the second click. This was the code in a template that you can purchase for use.

                I do like your consolidation. Thanks for replying.