Hello,

Working my way through this tutorial and I hit a wall.
I looked at the sample code and cannot figure out why this event is not 
available.

Any Idea's, probably something simple I am just not seeing, thanks...

This is the error I am getting:
Event type 'events:OptionSelectEvent' is unavailable.   AdobeODT/src    
AdobeODT.mxml   
line 61

This is the code for the AdobeODT.mxml I have marked the post where the error 
is with 
the text ERROR LINE.
Below is also the code for the Options.mxml code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
        layout="vertical" 
        horizontalAlign="left" paddingTop="5" backgroundColor="#FFFFFF" 
        creationComplete="init()" 
        xmlns:Components="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;
                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 was a problem","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 x="10" y="10" text="XYZ Convention" fontWeight="bold" 
fontSize="21"/>
        <mx:HBox>
                <mx:Text x="10" y="41" text="111 49th Ave. Denver, CO 80634"/>
                <mx:Text x="208" y="41" text="Phone: 303-555-1212"/>
                <mx:Text x="345" y="41" text="Fax: 303-555-1234"/>      
        </mx:HBox>
        
        <mx:Label x="10" y="72" text="Room Reservation System" fontSize="14" 
fontWeight="bold"/>
        <mx:Canvas height="100%">
        <mx:Label x="0" text="Please select any additional amenities needed for 
your room. 
Our staff will contact you to finialize your reservation"/>
        
        <Components:Options x="0" y="26" 
ERROR LINE      optionSelected="optionHandler(event)"/>
                <mx:Label x="0" y="116" text="Rooms Available"/>
        <mx:List id="dg" 
                x="0" y="142"  width="250" 
                itemClick="changeHandler(event)" 
                dataProvider="{roomList}" labelField="name" >
        </mx:List>      
        <Components:ReservationForm x="439" y="142" width="318" height="529" 
selectedOptions="{selectedOptions}"/>
        </mx:Canvas>
        
</mx:Application>

**********************END CODE*************


***********OPTIONS.MXML CODE*************


<?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="132" y="10" label="Dance Floor" 
click="clickHandler(event)"/>
        <mx:CheckBox x="10" y="10" label="Microphone" 
click="clickHandler(event)"/>
        <mx:CheckBox x="132" y="40" label="Special Lighting" 
click="clickHandler(event)"/>
        <mx:CheckBox x="529" y="10" label="Extra Trash Receptacals" 
click="clickHandler(event)"/>
        <mx:CheckBox x="272" y="10" label="Food Station" 
click="clickHandler(event)"/>
        <mx:CheckBox x="422" y="10" label="Security" 
click="clickHandler(event)"/>
        <mx:CheckBox x="422" y="40" label="Waitstaff" 
click="clickHandler(event)"/>
        <mx:CheckBox x="10" y="40" label="Projector" 
click="clickHandler(event)"/>
        <mx:CheckBox x="272" y="40" label="Color Table Linens" 
click="clickHandler(event)"/>
        <mx:CheckBox x="529" y="40" label="Additional Electrical Outlets" 
click="clickHandler(event)"/>
        
</mx:Canvas>

Reply via email to