2 Replies Latest reply on Sep 21, 2010 9:43 AM by MyersJ22

    Need help figuring out how to do something.

    MyersJ22

      I am new to flex so not entirely sure how I would accomplish this:

       

      You know how in HTML, you can click a button or a link and it would change what you see in an Iframe without reloading the entire page that you're on? I want to do the same thing with Flex but change what I have in my textarea that is to the right of my menu tabbed accordian menu. I am thinking that it may require states though I do not know how to do those. If it is states, how would I go about creating them and using them in the way that I have described? If it isn't states, what would I use and how would I use it?

       

      Any help would be appreciated.

        • 1. Re: Need help figuring out how to do something.
          MyersJ22 Level 1

          I think I figured it out! xD States would be the right way to go I think. I'd like a second opinion though.

           

          I just found this:

          http://livedocs.adobe.com/flex/3/html/help.html?content=using_states_3.html

           

          and I made this out of it:

           

          <?xml version="1.0"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
              <mx:states>
                  <mx:State name="First">
                      <mx:AddChild relativeTo="{v1}">
                          <mx:TextArea x="0" y="0" width="100%" height="100%" enabled="true" editable="false" verticalScrollPolicy="auto" maxChars="0">
                              <mx:htmlText>
                                  <![CDATA[First State]]>
                              </mx:htmlText>
                          </mx:TextArea>
                      </mx:AddChild>
                  </mx:State>
                  <mx:State name="Second">
                      <mx:AddChild relativeTo="{v1}">
                          <mx:TextArea x="0" y="0" width="100%" height="100%" enabled="true" editable="false" verticalScrollPolicy="auto" maxChars="0">
                              <mx:htmlText>
                                  <![CDATA[Second State]]>
                              </mx:htmlText>
                          </mx:TextArea>
                      </mx:AddChild>
                  </mx:State>       
              </mx:states>   
              <mx:VBox id="v1">
                  <mx:Button label="Change to First State" click="currentState = 'First';"/>           
                  <mx:Button label="Change to Second State" click="currentState = 'Second';"/>
              </mx:VBox>   
          </mx:Application>

          • 2. Re: Need help figuring out how to do something.
            MyersJ22 Level 1

            When I tried combining that with my current program, I got this error:

            The element type 'mx:states' must be terminated by the matching end-tag '</mx:states>'.

            Source Code of where error exsists:

                <mx:states>
                    <mx:State name="State1"/>
                    <mx:State name="First"/>
                        <mx:AddChild relativeTo="{v1}">
                            <mx:TextArea x="200" y="0" width="578" height="504" enabled="true" editable="false" verticalScrollPolicy="auto" maxChars="0">
                                <mx:htmlText>
                                    <![CDATA[First State]]>
                                </mx:htmlText>
                            </mx:TextArea>
                        </mx:AddChild>
                    </mx:State>       
                </mx:states>

            Anyone have any idea how to fix this? It didn't have a problem with it what I posted in my previous post.