Is your "mainDisplay" using some sort of Container? If so, maybe the view in it isn't created yet, and thus it only works once its created (thus the 2nd time)? As a test, set the creationPolicy to "all" (don't leave it like this or I'll get yelled at by Gordon).
----- Original Message ----- From: "Jeremy Rottman" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Wednesday, July 12, 2006 6:33 PM Subject: [flexcoders] Werid bug in my code I am working on a realestate app, the section I am working is where an admin converts an active listing to a sale. The process is pretty strait forward, I take all the data from the listing and insert it into the sale table. If the the listing has already been converted it returns and error and does not change the state. If there is no error, it changes teh state and populates the form components on the edit sale screen. Everything up to the point where I populate the form inputs works. The problem is it spits out this error, when I convert the first listing. After I convetr the first listing, and go to convert a second one, I no longer get this error, it changes the state and populates like it should. I have done this with the same record. The first time I get the error the second time I get the desired results. TypeError: Error #1009: Cannot access a property or method of a null object reference. at components.views.transactions::viewSearchList/::ConversionManager_Listin\ g_To_Sale_Result() at components.views.transactions::viewSearchList/___Operation3_result() at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven\ tFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::di\ spatchRpcEvent() at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resu\ ltHandler() at mx.rpc::Responder/result() at mx.rpc::AsyncRequest/acknowledge() at ::DirectHTTPMessageResponder/completeHandler() at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven\ tFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/flash.net:URLLoader::onComplete() This is the code I am using. //*****************CONVERT LISTING TO SALE START*************************** // CONFIMATION POPUP private function actionConvertSaleHandler(event:Event):void { Alert.show("Are you sure you want to convert?", "Confirm Conversion", 3, this, actionConvertSaleClickHandler); } // EVENT HANDLER private function actionConvertSaleClickHandler(event:CloseEvent):void { if (event.detail==Alert.YES) ConversionManager_Listing_To_Sale(listingSearchDG.selectedItem.FLD_FILEN\ UM); else return; } //CALL LISTING TO SALE METHOD private function ConversionManager_Listing_To_Sale(fileNum){ ConversionManager.Listing_To_Sale(fileNum) } //HANDLE LISTING TO SALE RESULTS private function ConversionManager_Listing_To_Sale_Result(result):void{ if (result.val == 0){ Alert.show(result.msg); parentApplication.mainDisplay.currentState = 'editSale'; parentApplication.mainDisplay.etes.fileNumber.text = result.fld_fileNum; parentApplication.mainDisplay.etes.mlsNum.text = result.fld_mlsNum; parentApplication.mainDisplay.etes.propNum.text = result.fld_propNum; parentApplication.mainDisplay.etes.propStreet.text = result.fld_propStreet; parentApplication.mainDisplay.etes.propUnitNum.text = result.fld_propUnitNum; parentApplication.mainDisplay.etes.propCity.text = result.fld_propCity; parentApplication.mainDisplay.etes.propState.text = result.fld_propState; parentApplication.mainDisplay.etes.propZip.text = result.fld_propZip; parentApplication.mainDisplay.etes.coeDate.text = result.fld_propCoe; parentApplication.mainDisplay.etes.contractDate.text = result.fld_propContractDate; parentApplication.mainDisplay.etes.propPrice.text = result.fld_propPrice; parentApplication.mainDisplay.etes.sellerComm.text = result.fld_sellerComm; parentApplication.mainDisplay.etes.buyerComm.text = result.fld_buyerComm; parentApplication.mainDisplay.etes.listNum.text = result.fld_listingNum; for (var i = 0;i < dirPrefixDP.length; i++) { if (dirPrefixDP[i].label == result.fld_propDir) { parentApplication.mainDisplay.etes.propDir.selectedIndex = i; } } for (var i = 0;i < dirSuffixDP.length; i++) { if (dirSuffixDP[i].label == result.propDirSuffix) { parentApplication.mainDisplay.etes.propDirSuffix.selectedIndex = i; } } for (var i = 0;i < unitTypeDP.length; i++) { if (unitTypeDP[i].label == result.propUnitType) { parentApplication.mainDisplay.etes.propUnitType.selectedIndex = i; } } for (var i = 0;i < designatorDP.length; i++) { if (designatorDP[i].label == result.propDesignator) { parentApplication.mainDisplay.etes.propDesignator.selectedIndex = i; } } } else if (result.val == 1) { Alert.show(result.msg); } } //HANDLE LSITING TO SALE FAULT private function ConversionManager_Listing_To_Sale_Fault(event:FaultEvent):void{ Alert.show("Test Error","Program Error") } //*****************CONVERT LISTING TO SALE END***************************** -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links ------------------------ Yahoo! Groups Sponsor --------------------~--> Check out the new improvements in Yahoo! Groups email. http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

