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

    Exercise 6- Cannot resolve attribute 'optionSelected' for component type component.Options.

    dseb

      I get that error when running working on exercise 6, I was on the beginnig of page 3, where you were supposed to run it, and I got that error.  How do I fix it?

        • 1. Re: Exercise 6- Cannot resolve attribute 'optionSelected' for component type component.Options.
          Gregory Lafrance Level 6

          The code in the exercise is this:

           

          <comp:Options x="0" y="26" optionSelected="optionHandler(event)"/>

           

          do you have this:

           

          <components:Options x="0" y="26" optionSelected="optionHandler(event)"/>

           

          and if so maybe that highlights an error in your code.

           

          If this post answered your question or helped, please mark it as such.

          • 2. Re: Exercise 6- Cannot resolve attribute 'optionSelected' for component type component.Options.
            dseb Level 1

            My code is: <comp:Options x="0" y="26"
                                  optionSelected="optionHandler(event)" />

            • 3. Re: Exercise 6- Cannot resolve attribute 'optionSelected' for component type component.Options.
              Gregory Lafrance Level 6

              You may need to post your entire code for us to see what you are doing.

              • 4. Re: Exercise 6- Cannot resolve attribute 'optionSelected' for component type component.Options.
                dseb Level 1

                Here is my code:

                 

                 

                <?xml version="1.0" encoding="utf-8"?>
                <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                    layout="vertical" backgroundColor="#FFFFFF"
                    creationComplete="init()"
                    paddingTop="5"
                    xmlns:comp="components.*">
                   
                    <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;
                           
                           
                            [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 changeHandler(event:ListEvent):void{

                 

                            }
                            private function httpResultHandler(event:ResultEvent):void{
                                roomList = event.result.rooms.room;
                            }
                            private function optionHandler(event:Event):void{
                                Alert.show("A checkbox was checked");
                            }
                        ]]>
                    </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="Rooms 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="142"
                                    width="318" height="529" />
                        </mx:Canvas>      

                 

                </mx:Application>

                • 5. Re: Exercise 6- Cannot resolve attribute 'optionSelected' for component type component.Options.
                  ChandanaVivek

                  Hi,

                   

                  Please check whether your Options.mxml code looks like this. It worked for me.

                   

                   

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

                  <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="840" height="80">

                  <mx:Script>

                  <![CDATA[

                  import events.OptionSelectEvent;

                  private function clickHandler(event:Event):void {

                  var selection:String = event.target.label;

                  var optionSelectEvent:OptionSelectEvent = new OptionSelectEvent("optionSelected",selection);

                  dispatchEvent(optionSelectEvent);

                  }

                  ]]>

                  </mx:Script>

                   

                  <mx:Metadata>

                   

                  [Event(name="optionSelected",type="events.OptionSelectEvent")]

                   

                  </mx:Metadata>

                   

                  <mx:CheckBox x="10" y="10" label="Microphone" id="microphone"

                  click="clickHandler(event)"/>

                  <mx:CheckBox x="132" y="10" label="Dance Floor" id="danceFloor"

                  click="clickHandler(event)"/>

                  <mx:CheckBox x="132" y="40" label="Special Lighting" id="specialLighting"

                  click="clickHandler(event)"/>

                  <mx:CheckBox x="272" y="10" label="Food Station" id="foodStation"

                  click="clickHandler(event)"/>

                  <mx:CheckBox x="422" y="10" label="Security" id="security"

                  click="clickHandler(event)"/>

                  <mx:CheckBox x="529" y="10" label="Extra Trash Recepticals" id="trash"

                  click="clickHandler(event)"/>

                  <mx:CheckBox x="10" y="40" label="Projector" id="projector"

                  click="clickHandler(event)"/>

                  <mx:CheckBox x="272" y="40" label="Color Table Linens" id="colorTableLinens"

                  click="clickHandler(event)"/>

                  <mx:CheckBox x="422" y="40" label="Waitstaff" id="waitstaff"

                  click="clickHandler(event)"/>

                  <mx:CheckBox x="529" y="40" label="Additional Electrical Outlets" id="electricalOutlets"

                  click="clickHandler(event)"/>

                   

                  </mx:Canvas>