I changed it so it get instantiated on the main init. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" width="760" height="500" backgroundColor="#000000" creationComplete="init()" xmlns:components="components.*" xmlns:views="views.*">
<mx:Style source="assets/css/styles.css"/> <mx:Script> <![CDATA[ import mx.controls.Alert; import mx.collections.ArrayCollection; import events.OptionsSavedEvent; import events.ClientSelectedEvent; import events.FileAddedEvent; public var client:Object; public var options:Object; public var files:ArrayCollection; private function init():void { client = new Object(); options = new Object(); } private function onClientSelected(event:ClientSelectedEvent):void { client = event.client; } private function onFileAdded(event:FileAddedEvent):void { files = event.files; } private function onOptionsSaved(event:OptionsSavedEvent):void { options = event.options; } ]]> </mx:Script> <mx:ViewStack id="vs" width="100%" height="100%"> <views:ClientSelector id="startPanel" vs="{vs}" clientSelected="onClientSelected(event)"/> <views:FileChooser id="fileChooser" vs="{vs}" fileAdded="onFileAdded(event)"/> <views:Options id="optionsPanel" vs="{vs}" optionsSaved="onOptionsSaved(event)"/> <views:Review id="reviewPanel" vs="{vs}" client="{client}" options="{options}" files="{files}"/> </mx:ViewStack> </mx:Application> Thank You Dan Vega [EMAIL PROTECTED] http://www.danvega.org On Sun, Jul 13, 2008 at 6:44 PM, Tracy Spratt <[EMAIL PROTECTED]> wrote: > Huh? My question was: > > How/when are you instantiating the "client" object? > > > > You just need to debug. > > Tracy > > > ------------------------------ > > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > Behalf Of *Dan Vega > *Sent:* Sunday, July 13, 2008 6:20 PM > *To:* flexcoders@yahoogroups.com > *Subject:* Re: [flexcoders] Application Design > > > > That is just the local variable for that screen. I was told If I wanted to > share information with the main application i had to push it back through an > event. > > > Thank You > Dan Vega > [EMAIL PROTECTED] > http://www.danvega.org > > On Sun, Jul 13, 2008 at 6:06 PM, Tracy Spratt <[EMAIL PROTECTED]> > wrote: > > No, that is setting "_client". You need to be setting "client". > > > > Or change to: > > client="{_client}" > > > > You just need to debug this. You reference passing methodology is correct. > > > > Tracy > > > ------------------------------ > > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > Behalf Of *Dan Vega > *Sent:* Sunday, July 13, 2008 5:44 PM > > > *To:* flexcoders@yahoogroups.com > *Subject:* Re: [flexcoders] Application Design > > > > ON the first screen when a user picks a client from the data grid > > > > private function onClientSelect(event:ListEvent):void { > _client = event.itemRenderer.data; > btnNext.enabled = true; > dispatchEvent(new > ClientSelectedEvent("clientSelected",_client)); > } > > > > Thank You > Dan Vega > > > [EMAIL PROTECTED] > http://www.danvega.org > > On Sun, Jul 13, 2008 at 5:51 PM, Tracy Spratt <[EMAIL PROTECTED]> > wrote: > > How/when are you instantiating the "client" object? > > > > Tracy > > > ------------------------------ > > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > Behalf Of *Dan Vega > *Sent:* Sunday, July 13, 2008 5:30 PM > > > *To:* flexcoders@yahoogroups.com > *Subject:* Re: [flexcoders] Application Design > > > > at views::Review/init()[H:\Program > Files\Apache\htdocs\Uploader\src\views\Review.mxml:27] > > which is this line > lblClientPhone.text = client.phone; > > Thank You > Dan Vega > > > [EMAIL PROTECTED] > http://www.danvega.org > > On Sun, Jul 13, 2008 at 5:38 PM, Tracy Spratt <[EMAIL PROTECTED]> > wrote: > > You get that error on what line? > > Tracy > > > ------------------------------ > > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > Behalf Of *Dan Vega > *Sent:* Sunday, July 13, 2008 5:23 PM > *To:* flexcoders@yahoogroups.com > *Subject:* Re: [flexcoders] Application Design > > > > I am just passing vs so that my next and previous buttons can increment or > decrement the selectedIndex of the view state. Basically when I get to my > final review screen and pass the data / files / client I try and output them > and I get this error > > TypeError: Error #1009: Cannot access a property or method of a null object > reference. > > I also put a breakpoint in the init method of the component and all of the > data is null at that point. > > Here is a quick piece of the component. > > <mx:Script> > <![CDATA[ > > > import mx.containers.ViewStack; > import mx.collections.ArrayCollection; > > private var _totalBytes:int = 0; > > public var vs:ViewStack; > > public var client:Object; > public var options:Object; > > > [Bindable] > public var files:ArrayCollection; > > > private function init():void { > //client data > lblClientName.text = client.client_name; > lblClientCity.text = client.city; > lblClientState.text = client.state; > lblClientZip.text = client.zip; > lblClientPhone.text = client.phone; > > > Thank You > Dan Vega > [EMAIL PROTECTED] > http://www.danvega.org > > > > > > > > >