Hi,

This is my first, perhaps ambitious FLEX application. The object is building a 
DVD catalog. 

The form uses:
Text Inputs
Combo Box
Text Area
Radio Buttons


I could use assistance with Getting the Field Data into XML, then Putting the 
XML file for 
use as the DataProvider for a Datagrid(View)


<code>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute" 
viewSourceURL="srcview/index.html">
<mx:Style>
                Label{fontFamily: Verdana; fontSize: 10pt; fontWeight: bold;}
</mx:Style>
        <mx:Script>

        <![CDATA[
        import flash.events.Event;
                [Bindable]public var titleOverview:XML
                private function addOverview(e:Event):void{     
                var titleOverview:XML = 
                         <dvdCollection>
                       <dvd>
                                <title>Pulp Fiction</title>;
                                <genre>Action</genre>;
                                <actors>John Travolta, Sam Jackson</actors>;
                                <directors>Quentin Tarantino</directors>
                                <producers>Lawrence Bender </producers>;
                       
                       </dvd>
                       
                </dvdCollection>  
         }   
        ]]>
    </mx:Script>
<mx:Panel title="DVD Collection: Add Title" height="500" width="530" 
paddingTop="5" 
paddingLeft="5" paddingRight="5" paddingBottom="5">
        <mx:Accordion id="dvdAccordion" height="450" width="500" x="10" y="31">
                <mx:Form id="dvdOverview" label="Overview" height="507" 
width="635">
                <mx:Label text="Title:" width="48" height="19" />
                        <mx:TextInput id="dvdTitle" width="290" height="25"/>
                <mx:Label text="Genre:" width="49" height="15" />
                        <mx:ComboBox width="290">
                                <mx:ArrayCollection>
                                        <mx:String>Action</mx:String>
                                        <mx:String>Sci-Fi</mx:String>
                                        <mx:String>Drama</mx:String>
                                        <mx:String>Foreign</mx:String>
                                        <mx:String>Comedy</mx:String>
                                        <mx:String>Horror</mx:String>
                                        <mx:String>Children's</mx:String>
                                        <mx:String>Romance</mx:String>
                                </mx:ArrayCollection>
                        </mx:ComboBox>
                <mx:Label text="Actors:" />
                <mx:TextArea id="dvdActors" width="450" />
                <mx:Label text="Director:"  />
                        <mx:TextInput id="dvdDirector" width="290" height="25"/>
                <mx:Label text="Producer(s):" />
                        <mx:TextInput id="dvdProducers" width="290" 
height="25"/>
    <mx:Button label="Add DVD Overiew" id="addOverviewBtn" 
click="addOverview(event);"/>   
        </mx:Form>              
        <mx:Form id="dvdDetails" label="Details" height="508" width="635">
        <mx:Label text="Plot:" />
                <mx:TextArea id="dvdPlot" width="450" />
                <mx:Label text="Review:" />
                <mx:TextArea id="dvdReview" width="450" />
           <mx:Label text="Rating:" />
                <mx:RadioButton groupName="dvdRating"
                        id="dvdWatachable"
                        label="Watachable"
                        width="150"/> 
                        <mx:RadioButton groupName="dvdRating"
                        id="dvdHorrible"
                        label="Horrible"
                        width="150"/>
                        <mx:RadioButton groupName="dvdRating"
                        id="dvdAwesome"
                        label="Awesome"
                        width="150"/>   
                <mx:Label text="Date Purchased (MM/DD/YYYY):"  />
                        <mx:DateField id="dvdPurchaseDate" width="125" />
                <mx:Label text="Price (dollars . cents) :"  />
                                <mx:HBox width="200">
                                                <mx:Text 
text="$"/><mx:TextInput width="50" 
height="20"/><mx:Text text="."/><mx:TextInput width="50" height="20"/>
                                </mx:HBox>
                        <mx:Label text="Date Released (MM/DD/YYYY):"  />
                        <mx:DateField id="dvdReleaseDate" width="125" />
                        <mx:Label text="Length (HH MM SS) :"   width="265"/>
                   
                                <mx:HBox width="200">
                                                <mx:TextInput width="50" 
height="20"/><mx:Text 
text=":"/><mx:TextInput width="50" height="20"/><mx:Text 
text=":"/><mx:TextInput 
width="50" height="20"/> 
                                </mx:HBox>
                         <mx:Button label="Add DVD Details" id="addDetailsBtn" 
/>       
                        </mx:Form>
                
        </mx:Accordion>
        </mx:Panel>
        <mx:Panel title="DVD Collection: View Titles" height="300" width="59%" 
paddingTop="5" paddingLeft="5" paddingRight="5" paddingBottom="5" x="0" y="518">
        <mx:DataGrid width="100%"  editable="true" variableRowHeight="true" 
x="538" 
height="250" dataProvider="{titleOverview.dvd}">
                <mx:columns>
                        <mx:DataGridColumn dataField="title" headerText="Title" 
 editable="false"  
/>
                        <mx:DataGridColumn dataField="genre" headerText="Genre" 
editable="false"  />
                        <mx:DataGridColumn dataField="actors" 
headerText="Actors" 
editable="true"  />
                        <mx:DataGridColumn dataField="directors" 
headerText="Director" 
editable="false" />
                        <mx:DataGridColumn dataField="producers" 
headerText="Producer" 
editable="true" />
                </mx:columns>
                
        </mx:DataGrid>
        </mx:Panel>
        <mx:Panel x="538" y="0" width="450" height="500" layout="absolute" 
title="DVD 
Collection: Detailed View">
        </mx:Panel>
</mx:Application>

</code>

Reply via email to