7 Replies Latest reply on Oct 20, 2008 1:29 PM by cputnam14

    Multiple click event

    rmorgan Level 1
      I am trying to "stack" multiple click events for a control and not having any luck.
      I have a starting panel:
      <mx:Panel x="26" y="10" width="250" height="200" layout="absolute">
      <mx:VBox y="10" height="140" width="173" x="10" id="vbox1">
      <mx:RadioButton label="Club" groupName="affiliation" click="currentState='ClubSelectState'" />
      <mx:RadioButton label="Constituent Group" groupName="affiliation" click="currentState='ConstituentSelectState'"/>
      <mx:RadioButton label="College" groupName="affiliation" click="currentState='CollegeSelectState'"/>
      <mx:RadioButton label="UK Alumni Association" groupName="affiliation" click="currentState=''"/>
      <mx:RadioButton label="UK Offices, Units" groupName="affiliation" click="currentState='UKOfficesSelectState'"/>
      </mx:VBox>
      </mx:Panel>

      As you can probably tell once someone clicks a radio button within this panel it will show a cooresponding panel(state). For instance, if the radio button Club is click it displays this panel:

      <mx:State name="ClubSelectState">
      <mx:AddChild position="lastChild">
      <mx:Panel id="clubpanel" y="10" width="250" height="200" layout="absolute" title="Select A Club" x="284" >
      <mx:VBox x="10" y="10" height="116" width="72" id="vbox2">
      <mx:RadioButton label="Club A" groupName="Clubs"/>
      <mx:RadioButton label="Club B" groupName="Clubs"/>
      <mx:RadioButton label="Club C" groupName="Clubs"/>
      <mx:RadioButton label="Club D" groupName="Clubs"/>
      </mx:VBox>
      </mx:Panel>
      </mx:AddChild>
      </mx:State>

      All of this works fine. I would like to add 'showEffect' and 'hideEffect' to this, specifically wipeRight and wipeLeft respectively. I have added the attributes to the club state panel like this, unsure if this is correct:
      <mx:Panel y="10" width="250" height="200" layout="absolute" title="Select A Club" x="284" showEffect="WipeRight" hideEffect="WipeLeft" >

      But I cannot seem to figure out how to add what I assume to be clubpanel.visible=true to the click attribute in this line:
      <mx:RadioButton label="Club" groupName="affiliation" click="currentState='ClubSelectState'" />

      Could someone enlighten me as to what I am doing wrong? TIA
        • 1. Re: Multiple click event
          cputnam14
          Just add it like this...
          It may need to invisible to start with though

          <mx:RadioButton label="Club" groupName="affiliation" click="clubpanel.visible = true; currentState='ClubSelectState; '" />
          • 2. Re: Multiple click event
            rmorgan Level 1
            Thanks. But now I get this:
            TypeError: Error #1009: Cannot access a property or method of a null object reference.
            • 3. Re: Multiple click event
              cputnam14 Level 1
              Hmm ok that didn't work the way I was thinking...
              Check out this link
              http://examples.adobe.com/flex3/componentexplorer/explorer.html

              Go to Effects, Transitions, and Viewstates
              Then Transitions.

              That is what you need
              • 4. Re: Multiple click event
                rmorgan Level 1
                Sorry, I am a noob with flex so bear with me. I looked at what you said and it still does not seem to work for me. Below is the code that I am using that does not work. I am just not sure if it is possible to do the way I am attempting and I need to look a little further into what you directed me to.

                <?xml version="1.0" encoding="utf-8"?>
                <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
                <mx:states>
                <mx:State name="ClubSelectState">
                <mx:AddChild position="lastChild" >
                <mx:WipeRight id="wipeIn" duration="1000"/>
                <mx:Panel x="284" y="10" width="250" height="200" layout="absolute" title="Select A Club" visible="{club.selected}" showEffect="{wipeIn}" >
                <mx:VBox x="10" y="10" height="119" width="141" id="vbox2" >
                <mx:RadioButtonGroup id="Clubs"/>
                <mx:RadioButton label="Club A" groupName="Clubs"/>
                <mx:RadioButton label="Club B" groupName="Clubs"/>
                <mx:RadioButton label="Club C" groupName="Clubs"/>
                <mx:RadioButton label="Club D" groupName="Clubs"/>
                </mx:VBox>
                </mx:Panel>
                </mx:AddChild>
                </mx:State>
                </mx:states>
                <mx:Panel x="26" y="10" width="250" height="200" layout="absolute" id="panel1">
                <mx:VBox y="10" height="140" width="173" x="10" id="vbox1">
                <mx:RadioButtonGroup id="affiliation"/>
                <mx:RadioButton id="club" label="Club" groupName="affiliation" click="currentState='ClubSelectState'" />
                </mx:VBox>
                </mx:Panel>
                </mx:Application>
                • 5. Re: Multiple click event
                  cputnam14 Level 1
                  See if this works for you:

                  • 6. Re: Multiple click event
                    rmorgan Level 1
                    Awesome!! Thanks, I guess thats all I needed was a working example to get me going in the right direction.

                    I will think of you at 420.
                    • 7. Re: Multiple click event
                      cputnam14 Level 1
                      haha smoke an extra one for me!