2 Replies Latest reply on Apr 18, 2007 2:15 PM by MadamZuZu

    Flex and XML - Help Please

    MadamZuZu
      Hello :)
      im trying to write my first app.
      basically, it's just a FAQ kind of app.
      i want to be able to read "questions and answers" from an XML file, and display them in a list.
      the first issue im having is that if the answer is too long, it does not wrap, and i can't figure out how to line-break it. to make paragraphs.


      please help.

      here is what i have so far:

      [code]
      <?xml version="1.0"?>
      <!-- Simple example to demonstrate the List Control -->
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">

      <mx:Script>
      <![CDATA[
      [Bindable]
      public var selectedItem:Object;

      [Bindable]
      public var helpful: Array = [ {label:"Yes", data:1},
      {label:"No", data:2}];

      ]]>




      </mx:Script>


      <mx:Model id="mystates" >
      <states>
      <state label="How do i reset my password?" data="call iTAC" data2=""/>
      <state label="When does my password expire?" data="never" data2="this is a second paragraph"/>
      <state label="How do i search for a ticket?" data="do this and that" data2=""/>
      <state label="When does my password expire?" data="never" data2="this is a second paragraph"/>
      <state label="How do i search for a ticket?" data="do this and that" data2=""/>
      <state label="When does my password expire?" data="never" data2="this is a second paragraph"/>
      <state label="How do i search for a ticket?" data="do this and that" data2=""/>
      <state label="When does my password expire?" data="never" data2="this is a second paragraph"/>
      <state label="How do i search for a ticket?" data="do this and that" data2=""/>
      <state label="How do i search for a ticket?" data="do this suuuuuuuupppppppppeeeeeeeeeeeerrrrrrr llllloooooooooooonnnnnnnnnggggggg aaaaaaaaaaaaaaannnnnnnnnnnnnssssssssswwwwwwwwwwwwwwweeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrr and that" data2=""/>
      </states>
      </mx:Model>


      <mx:Panel title="DSBS Help Menu - Example 1" height="75%" width="75%"
      paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">

      <mx:Label text="How do i?"/>

      <mx:List id="source" width="100%" color="blue"
      dataProvider="{mystates.state}"
      change="this.selectedItem=List(event.target).selectedItem"/>

      <mx:VBox width="100%">
      <mx:Label text="Q: {selectedItem.label}" fontWeight="bold"/>
      <mx:Label text="A: {selectedItem.data}"/>
      <mx:Label text="{selectedItem.data2}"/>
      </mx:VBox>

      <mx:ComboBox dataProvider="{helpful}" width="150"
      close="selectedItem=ComboBox(event.target).selectedItem"/>

      <mx:VBox width="250">
      <mx:Label text="You selected: {selectedItem.label}"/>
      </mx:VBox>



      </mx:Panel>
      </mx:Application>
      [/code]