I built a small app that has 4 screens and everything is working great. I want to learn more about breaking up the views into different components before I move on to mvc in Flex. My question is lets say I have my main application and then each of my screens are views. In my main application I have a public variable called _client. On the first view I am trying to access that object and the compiler is telling me it is undefined. In my code you will the line _client = selected.
My question is how does the component know about the data declared in the main application ? <?xml version="1.0" encoding="utf-8"?> <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" layout="vertical" title="Rogers Image Uploader - Start" backgroundColor="#000" creationComplete="init()"> <mx:Script> <![CDATA[ import mx.events.ListEvent; private function init():void { // disable the next button until a client is selcted btnNextStart.enabled = false; // listen for changes on the client grid dgClients.addEventListener(ListEvent.CHANGE,onSelectClient); } private function onSelectClient(event:ListEvent):void { var selected:Object = event.itemRenderer.data; _client = selected; btnNextStart.enabled = true; } ]]> </mx:Script> <mx:DataGrid id="dgClients" dataProvider="{_clients}" width="100%" height="100%"> <mx:columns> <mx:DataGridColumn headerText="" labelFunction="rowNumber" width="40"/> <mx:DataGridColumn headerText="Client" dataField="client_name" width="250"/> <mx:DataGridColumn headerText="City" dataField="city"/> <mx:DataGridColumn headerText="State" dataField="state"/> <mx:DataGridColumn headerText="Zip" dataField="zip"/> <mx:DataGridColumn headerText="Phone" dataField="phone"/> <mx:DataGridColumn headerText="Status" dataField="status" labelFunction="statusRenderer"/> </mx:columns> </mx:DataGrid> <mx:ControlBar> <mx:Button label="Previous" enabled="false"/> <mx:Spacer width="100%"/> <mx:Label text="Select a client and click next." color="#ffffff"/> <mx:Spacer width="100%"/> <mx:Button id="btnNextStart" label="Next" click="{this.currentState='uploader'}"/> </mx:ControlBar> </mx:Panel> Thank You Dan Vega [EMAIL PROTECTED] http://www.danvega.org

