BTW everyone, I forgot to here's what the app looks like before any data is displayed:
http://pdfserver.amlaw.com/Production/WebApp/view/pages/APTI/myaccountprofiledemo.html I'm only expecting data to display on first page at this point. As you see in the example, the display pods on the first page of the application are empty; no text fields appear inside them. Brian, do the text fields show up after you compile the project on your side? I'll wait for your screenshots. --- In [email protected], "Dealy, Brian" <[EMAIL PROTECTED]> wrote: > > > > > > Hi, I put your zip file into my flex builder and ran it under debug > after commenting out > > a few imports i did not have and which it did not seem to need, but > > it ran and seems to dispatch ok for me. > > I put breakpoints on the event handlers and they were reched and I > snapped what the screen looks > > like, etc. > > > > (not sure if attachments will work here, email me and I will send them > direct). > > here are screen snaps of what it looked like and the debug showing the > contents after a handler was called. > > > > the only thing I noticed that I had a problem with is Flex Builder > complained about the XML files > > in the project as some had an & or a '/" in them. I removed them before > running... > > practiceArea.xml was one (if not the only one) > > > > I hope this helps. > > Brian > > > > > > Brian Dealy > > Vice President - Technology > > SAIC Technical Fellow > > Science Application International Corp. > > San Diego, CA > > 858-826-4457 > > [EMAIL PROTECTED] > > > > > > > > From: > [EMAIL PROTECTED] > oo.com > [mailto:[EMAIL PROTECTED] > oups.yahoo.com] On Behalf Of jwebbsuccess > Sent: Monday, January 07, 2008 11:43 AM > To: [email protected] > Subject: [flexcoders] Custom Component not Responding to Event Dispatch > - Can You Help Me Debug? > > > > I'm developing a custom component called 'DisplayPod' that is supposed > to build its internal controls based on an event. > > Once the application's 'front controller' parses external application > data into different categories, it notifies all instances of the > DisplayPod custom component through event dispatching. The custom event > type that is dispatched, called DisplayPodEvent, has different names; > each name correlates to one of the parsed categories. If an > instance-level property in the DisplayPod matches the event name, the > component will build itself accordingly (the component's child-level > controls are determined by the associated category so it is designed to > build its controls for any of the categories it has been pre-set to > dipslay). > > The problem is that the DisplayPod is not responding to the event > dispatch, even though it is clearly listening for that event. When I > debug the app, I get the following output: > ------------------------------------------------------------ > > [SWF] C:\...\Flex Builder > 3\MyAccountFlexDemo\bin-debug\MyAccountFlexDemo.swf - 1,271,036 bytes > after decompression > The displayProfile Display Pod is listenting. > The displayAccessInfo Display Pod is listenting. > The displayContactInfo Display Pod is listenting. > Dispatching... > All 5 DisplayPodEvents have been dispatched. > > ------------------------------------------------------------ > The DisplayPod instances have been preset with their own names to match > the available DisplayPodEvents... > The DisplayPod instances have successfully attached the appropriate > event listener function (via 'addEventListener()' )... > The FrontController has dispatched all of the versions of the > DisplayPodEvent as required... > > Additionally, I've registered the DisplayPod custom component with each > of the DisplayPodEvent names through a metadata tag. With all these > factors considered, I don't understand why the DisplayPod's listener > function isn't triggered after the FrontController does its event > dispatch. > > Can you help me figure why this isn't happening as it should and how to > trigger the listener function? Thanks. I've included a code sample in > this thread and I've placed the entire app here: > http://www.futurewebstudios.com/flex_src.zip > > Here's the code where the dispatch is taking place; this should REPLACE > the file of the same name in the zip file as it is more current: > > package controller { > > import flash.events.Event; > import flash.events.EventDispatcher; > import flash.net.URLLoader; > import flash.net.URLLoaderDataFormat; > import flash.net.URLRequest; > import mx.core.Application; > import mx.events.FlexEvent; > import model.ApplicationDataModel; > import model.data.User; > import events.DisplayPodEvent; > > /* > The FrontController class is the centralized location for event > handling in the application. > */ > public class FrontController extends EventDispatcher { > > /* Class-level properties */ > public static const XML_DATA_SOURCE:String = > "model/database/xml/"; > > /* Instance-level properties */ > private var _app:MyAccountFlexDemo = Application.application as > MyAccountFlexDemo; > [Bindable] > private var _dataModel:ApplicationDataModel = > ApplicationDataModel.getInstance(); > > /* Class constructor */ > public function FrontController():void { > _app.addEventListener( FlexEvent.CREATION_COMPLETE, > onCreationComplete ); > } > > /* Instance-level methods */ > private function onCreationComplete( e:FlexEvent ):void { > > var usersXmlLoader:URLLoader = new URLLoader(); > usersXmlLoader.dataFormat = URLLoaderDataFormat.TEXT; > usersXmlLoader.addEventListener( Event.COMPLETE, > onUsersXMLLoadComplete ); > usersXmlLoader.load( new URLRequest( XML_DATA_SOURCE + > "users.xml" ) ); > > var accessInfoXmlLoader:URLLoader = new URLLoader(); > accessInfoXmlLoader.dataFormat = URLLoaderDataFormat.TEXT; > accessInfoXmlLoader.addEventListener( Event.COMPLETE, > onAccessInfoXMLLoadComplete ); > accessInfoXmlLoader.load( new URLRequest( XML_DATA_SOURCE + > "dpAccessInfoForm.xml" ) ); > > var contactInfoXmlLoader:URLLoader = new URLLoader(); > contactInfoXmlLoader.dataFormat = URLLoaderDataFormat.TEXT; > contactInfoXmlLoader.addEventListener( Event.COMPLETE, > onContactInfoXMLLoadComplete ); > contactInfoXmlLoader.load( new URLRequest( XML_DATA_SOURCE + > "dpContactInfoForm.xml" ) ); > > var passwordEditXmlLoader:URLLoader = new URLLoader(); > passwordEditXmlLoader.dataFormat = URLLoaderDataFormat.TEXT; > passwordEditXmlLoader.addEventListener( Event.COMPLETE, > onPasswordEditXMLLoadComplete ); > passwordEditXmlLoader.load( new URLRequest( XML_DATA_SOURCE > + "dpPasswordEditForm.xml" ) ); > > var profileXmlLoader:URLLoader = new URLLoader(); > profileXmlLoader.dataFormat = URLLoaderDataFormat.TEXT; > profileXmlLoader.addEventListener( Event.COMPLETE, > onProfileXMLLoadComplete ); > profileXmlLoader.load( new URLRequest( XML_DATA_SOURCE + > "dpProfileForm.xml" ) ); > > var subscriptionReportXmlLoader:URLLoader = new URLLoader(); > subscriptionReportXmlLoader.dataFormat = > URLLoaderDataFormat.TEXT; > subscriptionReportXmlLoader.addEventListener( > Event.COMPLETE, onSubscriptionReportXMLLoadComplete ); > subscriptionReportXmlLoader.load( new URLRequest( > XML_DATA_SOURCE + "dpSubscriptionReportForm.xml" ) ); > } > > private function onUsersXMLLoadComplete( e:Event ):void { > _dataModel.usersList = XMLList( e.target.data ); > > /* Select individual user from users list;; to be determined > randomly > at later date */ > setCurrentUser( _dataModel.usersList.user[ 0 ] ); > } > > private function onAccessInfoXMLLoadComplete( e:Event ):void { > _dataModel.displayPodForms["AccessInfo"] = XMLList( > e.target.data ); > } > > private function onContactInfoXMLLoadComplete( e:Event ):void { > _dataModel.displayPodForms["ContactInfo"] = XMLList( > e.target.data ); > } > > private function onPasswordEditXMLLoadComplete( e:Event ):void { > _dataModel.displayPodForms["PasswordEdit"] = XMLList( > e.target.data ); > } > > private function onProfileXMLLoadComplete( e:Event ):void { > _dataModel.displayPodForms["Profile"] = XMLList( > e.target.data ); > } > > private function onSubscriptionReportXMLLoadComplete( e:Event > ):void { > _dataModel.displayPodForms["SubscriptionReport"] = XMLList( > e.target.data ); > } > > private function setCurrentUser( item:XML ):void { > > _dataModel.currentUser.userId = item.userid; > _dataModel.currentUser.password = item.password; > _dataModel.currentUser.occupation = item.occupation; > _dataModel.currentUser.industry = item.industry; > _dataModel.currentUser.firm = item.firm; > _dataModel.currentUser.subscribeDate = item.subscribedate; > _dataModel.currentUser.firstName = item.firstname; > _dataModel.currentUser.lastName =item.lastname; > _dataModel.currentUser.address1 = item.address1; > _dataModel.currentUser.address2 = item.address2; > _dataModel.currentUser.city = item.city; > _dataModel.currentUser.region = item.region; > _dataModel.currentUser.countryCode = item.countrycode; > _dataModel.currentUser.postalCode = item.postalcode; > _dataModel.currentUser.phone = item.phone; > _dataModel.currentUser.fax = item.fax; > _dataModel.currentUser.email = item.email; > _dataModel.currentUser.yearsOfPractice = > item.yearsofpractice; > _dataModel.currentUser.jobTitle = item.jobtitle; > var subscriptions:Array = new Array(); > var node:XML; > for each ( node in item.subscriptions ) { > for each ( node in node.subscription ) { > subscriptions.push( String( node.children() ) ); > } > } > _dataModel.currentUser.subscriptions = subscriptions; > > /* Now that currentUser is available, separate user's data > for display on various > pages of application */ > getUserDataForDisplayPods( _dataModel.currentUser ); > > } > > private function getUserDataForDisplayPods( u:User ):void { > > /* Establish AccountDataGroups from selected user's > properies */ > var adp:AccountDataParser = new AccountDataParser( u ); > _dataModel.userProfile = adp.createAccountDataGroup( > AccountDataParser.PROFILE ); > _dataModel.userAccessInfo = adp.createAccountDataGroup( > AccountDataParser.ACCESS_INFO ); > _dataModel.userContactInfo = adp.createAccountDataGroup( > AccountDataParser.CONTACT_INFO ); > _dataModel.userPasswordEdit = adp.createAccountDataGroup( > AccountDataParser.PASSWORD_EDIT ); > _dataModel.userSubscriptionReport = > adp.createAccountDataGroup( AccountDataParser.SUBSCRIPTION_REPORT ); > > /* Send the established AccountDataGroups to their > respective DisplayPods */ > trace( "Dispatching..." ); > _app.dispatchEvent( new DisplayPodEvent( > _dataModel.userProfile, DisplayPodEvent.DISPLAY_PROFILE ) ); > _app.dispatchEvent( new DisplayPodEvent( > _dataModel.userAccessInfo, DisplayPodEvent.DISPLAY_ACCESS_INFO ) ); > _app.dispatchEvent( new DisplayPodEvent( > _dataModel.userContactInfo, DisplayPodEvent.DISPLAY_CONTACT_INFO ) ); > _app.dispatchEvent( new DisplayPodEvent( > _dataModel.userPasswordEdit, DisplayPodEvent.DISPLAY_PASSWORD_EDIT) ); > _app.dispatchEvent( new DisplayPodEvent( > _dataModel.userSubscriptionReport, > DisplayPodEvent.DISPLAY_SUBSCRIPTION_REPORT ) ); > trace( "All 5 DisplayPodEvents have been dispatched." ); > > } > > } > } >

