1 Reply Latest reply on Jan 18, 2010 9:45 AM by devJT1

    Excercise 3

    vbangflex

      Hi,

       

      The flex debugger is not working and I am unable to figure out what is the problem with this excercise. Room names are not filled in the list control. Can anybody help me.

       

      In order flex debugger to work I uninstalled flash player and reinstalled flash player. I also installed debugger version. Nothing is helping me. Also I am getting actionscript erros. What is wrong with this? I am stuck with this from past one week. I am unable to go further. Please help me.

       

      Thanks

      vshree

       

      Here is my code

       

      ?xml version="1.0" encoding="utf-8"?>

      <mx:Application

       

       

      creationComplete="init()" xmlns:mx="http://www.adobe.com/2006/mxml"

      layout="

      absolute" backgroundColor="#FFFFFF">

       

       

      <mx:Script>

      <![CDATA[

       

      import mx.events.ListEvent;

       

      import mx.collections.ArrayCollection;

       

      import mx.rpc.events.FaultEvent;

       

      import mx.controls.Alert;

       

      import mx.rpc.events.ResultEvent;

       

      private function changeHandler(event:ListEvent):void{

      }

      [

      Bindable]

       

      private var roomList:ArrayCollection;

       

      private function init():void{

      rooms.send();

      }

       

      private function httpFaultHandler(event:FaultEvent):void{

      Alert.show(

      "There was a problem", "Error");

      }

       

      private function httpResultHandler(event:ResultEvent):void{

      roomList=event.result.rooms.room

      }

      ]]>

       

       

      </mx:Script>

       

       

       

      <mx:HTTPService id="rooms" url="assets/roomList.xml" fault="httpFaultHandler(event)"/>

       

       

      <mx:Label text="XYZ Convention Center"

      x="

      10" y="10"

      fontSize="

      21" fontWeight="bold"/>

       

      <mx:Text x="10" y="41"

      text="

      111 49th Ave, Denver, CO 80634"/>

       

      <mx:Text text="Phone: 303-555-1212" x="208" y="41"/>

       

      <mx:Text text="Fax: 303-555-1234" x="345" y="41"/>

       

      <mx:Label text="Room Reservation System"

      fontWeight="

      bold" fontSize="14"

      x="

      10" y="72"/>

       

      <mx:Label text="Room Available:" x="10" y="108"/>

       

      <mx:List id="dg" x="10" y="134" width="250"

      dataProvider="

      {roomList}"

      itemClick="changeHandler(event)"

      labelField="

      name"/>

       

        

      </mx:Application>

        • 1. Re: Excercise 3
          devJT1

          Hey Vshree,

          Try adding a semicolon to the end of the line within the httpResultHandler function like this,


              roomList=event.result.rooms.room;

           

          That should clear up the syntax error.

           

          Then, add the result event to the HTTPService tag,


              <mx:HTTPService id="rooms" url="assets/roomList.xml"

                  fault="httpFaultHandler(event)" 

                 result="httpResultHandler(event)"/>

           

          You should see the rooms populated within the List element.

           

          Hope this helps.

          Jeff