3 Replies Latest reply on Jan 12, 2008 8:16 AM by Newsgroup_User

    Flash Radio Buttons

    Level 7
      Okay, I give up, I've searched online and in several forums, pored through
      the Director documentation, and can't find a single tutorial explaining how
      exactly to use the Flash component Radio Buttons in Director. And
      apparently I'm not alone, about all I could find was another post in this
      group from over a month ago asking the same question without getting a
      single response. (Also found a few other questions regarding them in other
      forums, but one thing I didn't find anywhere was anyone actually *answering*
      these questions.) Do I have to actually use Flash to get these to work?
      Assume for a moment that I know exactly nothing about Flash (not far from
      the truth). What exactly do you have to do to make the other buttons
      automatically deselect when you click one? According to what little
      documentation there is in the Director help files, this should happen
      automatically, but apparently I'm missing something, because it doesn't.

      This was relatively simple with the old classic Radio Buttons, and I'm
      seriously considering just going back to using those (never mind the
      primitive graphics), or maybe just scripting my own from scratch. (It's not
      really that complicated a behavior, and at this point it seems like it would
      be easier than trying to use what seems to be an almost completely
      undocumented feature...)

        • 1. Re: Flash Radio Buttons
          Level 7
          The Flash Components are not documented in Director, though they are
          documented in Flash. If you can parse the dense and difficult to
          understand Flash Help file (and yes, you would need to have Flash to get
          it), then you can see all the docs for those components.

          Before I go much further, I should say that in my experience, using
          #flashComponents is a painful and tedious business. I do not recommend
          it. It will probably be MUCH easier on you in the long run if you write
          your own script from scratch.

          But, for the sake or archival completeness, this is a script that will
          do what you want with the checkbox/radio button #flashComponents:

          1) Go into the Property Inspector and on the FlashComponent tab for each
          member, make sure that the eventPassMode is set to #passAlways

          2) Put this code onto the buttons:

          on mouseUp me
          if sprite(me.spriteNum).selected then
          end if

          on deselect me, vExcept
          if me.spriteNum<>vExcept then
          end if
          • 2. Re: Flash Radio Buttons
            Level 7
            Hmm. My code was functionally not much different from yours. (I didn't use
            sendAllSprites because I've got more than one independant group of Radio
            Buttons, and I only want each to send to the other sprites in the same
            group, but otherwise it's not much different.) I guess the only thing I was
            missing was the eventPassMode setting. But anyhow, what you're basically
            telling me is that contrary to the Director documentation, this does NOT
            happen automatically? Or is that the part I'd need to know more about Flash
            to get to happen? (I've tried programming in Flash before, man that was a
            pain. Everything is 10 times more complicated than it needs to be...)

            You may be right that just doing this from scratch would be the easier plan.
            I know I can drum up that code on my own, I just figured why bother
            reinventing the wheel if the feature is there in the program? But if it's
            as complicated as you say, (and as my limited experience in Flash
            corroborates) it might truly be the easier way to do it.

            • 3. Re: Flash Radio Buttons
              Level 7
              I fully agree with you, I have had very few good experiences programming
              in Flash. But these #flashComponents are useful for only very simple
              tasks. Anything more complex, like trying to set their state on
              beginSprite for example, is a true torment. Try it. It's fun.

              You can actually use your existing code to make your own custom buttons.
              Just make a property called "selected" and set it to switch to 1 or 0
              when it gets clicked. Keep that same code you have to tell the other
              ones in the group to uncheck. And change the member of the sprite to
              the appropriate member.