Hi, Dan Pride wrote: > Odd, actually I have to call it in both places in its entirety, then it works > fine. If I call the display from the double click, then fill from the > complete, it misses the selected. > > But if I call it from both it works fine. > > So if I do this am I always running it twice or just on the first go round > then its "Complete" ?? >
The creation complete will handle the case of the first time you edit. That is, it fixes the original problem. Creation complete will only run once. I'm guessing the applicationScreens component is actually a ViewStack. If so, this is what i think might be happening: . The first time you edit your data the "edit" component has not been created yet(it's lazily created by this line: applicationScreens.selectedChild = locaScreen), so setting the data doesn't work as expected(original problem of first edit not getting data) due to the fact that the input fields don't exist yet. . Then the edit component's creation complete event handler runs and sets the data(so editing works the first time now). . Next time you edit the data the creation complete does not run again as the component now exists. So you still need to set the data in the function that actually sets up the edit component(your original code). Now you have the same code in two places; which is not what you want obviously. You should be able to check whats going on by using the debugger; setting a breakpoint in the creation complete function and in your displayLoca function. There is another solution that might be suitable, but is probably not a good idea. The viewstack has a creationPolicy setting that allows the viewstack to create all of its children when it's created. Rather than using the default lazy creation. This is often /not/ a good idea for performance reasons, but it would mean that the original problem would not occur and you could remove the code from the creation complete event handler and go back to your original code. So, your left with at least 3 choices: a) Duplicate code and setting data externally on a component(current solution). b) Modifying the viewstack creation policy to create all children when its created(easy but a performance hit). c) The solution I outlined previously. >>> >>> private function displayLoca():void{ >>> applicationScreens.selectedChild = locaScreen; >>> locaScreen.selectedItem = locaGrid.selectedItem; >>> } >>> >>> >>> And something like the following in your "edit >>> component": >>> >>> private var _selectedItem:Object; >>> >>> public function set selectedItem(o:Object):void{ >>> _selectedItem = o; >>> >>> if (_selectedItem) callLater(updateInputs); >>> } >>> >>> public function get selectedItem():Object{ >>> return _selectedItem; >>> } >>> >>> private function updateInputs():void{ >>> locaName.text = _selectedItem.NameCol; >>> locaField.text = _selectedItem.FieldCol; >>> locaSquare.text = _selectedItem.SquareCol; >>> } HTH. - shaun