0 Replies Latest reply on Sep 22, 2009 12:22 PM by ChandanaVivek

    Exercise 6 - Error: Cannot resolve attribute 'selectedOptions' for component type components.ReservationForm.     AdobeODT/src     AdobeODT.mxml     line 71

    ChandanaVivek

      Hi,

       

      I'm getting this error when I'm trying to save AdobeODT.mxml file.  I've declared the "selectedOptions" variable as public. Can you please tell me where I went wrong? Please find my code below. I'm getting error on the line marked in red.

      Thanks in advance

       

      AdobeODT.mxml

      --------------------------

       

       

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

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

      layout="vertical" backgroundColor="#FFFFFF"

      creationComplete="init()"

      horizontalAlign="left"

      paddingTop="5"

      xmlns:comp="components.*">

       

      <mx:Script>

      <![CDATA[

      import mx.rpc.events.ResultEvent;

      import mx.events.ListEvent;

      import mx.collections.ArrayCollection;

      import mx.rpc.events.FaultEvent;

      import mx.controls.Alert;

      import mx.rpc.events.ResultEvent;

      import events.OptionSelectEvent;

      [Bindable] private var roomList:ArrayCollection;

      [Bindable]

      public var selectedOptions:ArrayCollection = new ArrayCollection();

       

      private function changeHandler(event:ListEvent):void{

       

      }

      private function init():void{

      rooms.send();

      }

      private function httpFaultHandler(event:FaultEvent):void{

      Alert.show("There is an error","Error");

      }

      private function httpResultHandler(event:ResultEvent):void{

      roomList=event.result.rooms.room;

      }

      private function optionHandler(event:OptionSelectEvent):void{

      var index:int=selectedOptions.getItemIndex(event.option);

      if(index == -1){

      selectedOptions.addItem(event.option);

      }

      else{

      selectedOptions.removeItemAt(index);

      }

      }

      ]]>

      </mx:Script>

       

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

      fault="httpFaultHandler(event)"

      result="httpResultHandler(event)"/>

       

      <mx:Label text="XYZ Convention Center"

      x="10" y="10"

      fontSize="21" fontWeight="bold"/>

      <mx:HBox>

      <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:HBox>

      <mx:Label text="Room Reservation System"

      fontWeight="bold" fontSize="14"

      x="10" y="72" />

      <mx:Canvas height="100%">

      <mx:Label x="0" text="Please select any additional amenities needed for your room. Our staff will contact you to finalize your reservation" />

      <comp:Options x="0" y="26"

      optionSelected="optionHandler(event)"/>

      <mx:Label text="Room Available:" x="0" y="116"/>

      <mx:List id="dg" x="0" y="142" width="250"

      dataProvider="{roomList}"

      itemClick="changeHandler(event)"

      labelField="name"/>

      <comp:ReservationForm x="439" y="114" width="318" height="529" selectedOptions="{selectedOptions}"/>

      </mx:Canvas>

      </mx:Application>