You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by CodeGirl <Mi...@yahoo.com> on 2014/12/08 17:10:11 UTC

result Handler fires but last result does not contain the correct data in Actionscript file

If I have this same function in an mxml file, the last result returns the
correct info but when its in an action script file, it does not.   Why?  is
there something I need to do different?

		protected function setAResult_resultHandler(event:ResultEvent):void
		{
			if (event.result != null)
			{
				var thisDTO:ADTO = setAResult.lastResult;
				if (dataList[indx].id == 0)
				{
					dataList[indx] = thisDTO;
					var eventObject:ChangeA = new ChangeA("aChanged", thisDTO.id, true);
					var dispatch:EventDispatcher = new EventDispatcher();
					dispatch.dispatchEvent(eventObject);
				}
				Alert.show(updateSuccessMessage);
			}
		}



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/result-Handler-fires-but-last-result-does-not-contain-the-correct-data-in-Actionscript-file-tp9018.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: result Handler fires but last result does not contain the correct data in Actionscript file

Posted by CodeGirl <Mi...@yahoo.com>.
All of the sudden, its working.   The only thing I know I did was reboot my
computer.   Sure I was playing around trying to get it to work.   So I have
no clue if I did something or if rebooting fixed the issue.   Now I have to
figure it out so I can repeat whatever caused it to work for all the other
places I am using this method.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/result-Handler-fires-but-last-result-does-not-contain-the-correct-data-in-Actionscript-file-tp9018p9103.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: result Handler fires but last result does not contain the correct data in Actionscript file

Posted by CodeGirl <Mi...@yahoo.com>.
This first image show a new unsaved item in the grid.   Notice id = 0.

<http://apache-flex-users.2333346.n4.nabble.com/file/n9041/aaNew_Record.png> 

This image shows in debug that when the setTrip result event is fired for
some reason its still the unsaved record zero rather than the saved id which
the web service is suppose to return.  The third image will show that the
web service does return the saved id but why isnt it available in the action
script file when the result event is fired?  I need to send the saved id to
the grandparent so when I create children Trip Legs, I have the trip id to
assign to it.

<http://apache-flex-users.2333346.n4.nabble.com/file/n9041/aaSet_Fired_Last_result.png> 

<http://apache-flex-users.2333346.n4.nabble.com/file/n9041/aawhat_should_have_been_last_result.png> 


When I did the exact same thing in the mxml file, I was getting the correct
id number.   But when I moved the code to the actionscript file, now its not
returning the correct id.   Why?  How can this be fixed?





--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/result-Handler-fires-but-last-result-does-not-contain-the-correct-data-in-Actionscript-file-tp9018p9041.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: result Handler fires but last result does not contain the correct data in Actionscript file

Posted by CodeGirl <Mi...@yahoo.com>.
this question stems from my last question.   If you look at the example.zip
file but add the extend as suggested then debug the set result function you
will see what I am saying.   Except the example is not using a web service.  
For some reason this same function return the correct id when in the mxml
file but returns the original 0 id when in the actionscript file.   Not sure
why since the set result function is suppose to be triggered when the set
has completed and the returned result is available.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/result-Handler-fires-but-last-result-does-not-contain-the-correct-data-in-Actionscript-file-tp9018p9021.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: result Handler fires but last result does not contain the correct data in Actionscript file

Posted by Alex Harui <ah...@adobe.com>.
It isn’t clear from this what the correct/incorrect info is, and how it
was set up to be called?  More detail might help.

-Alex

On 12/8/14, 8:10 AM, "CodeGirl" <Mi...@yahoo.com> wrote:

>If I have this same function in an mxml file, the last result returns the
>correct info but when its in an action script file, it does not.   Why?
>is
>there something I need to do different?
>
>		protected function setAResult_resultHandler(event:ResultEvent):void
>		{
>			if (event.result != null)
>			{
>				var thisDTO:ADTO = setAResult.lastResult;
>				if (dataList[indx].id == 0)
>				{
>					dataList[indx] = thisDTO;
>					var eventObject:ChangeA = new ChangeA("aChanged", thisDTO.id, true);
>					var dispatch:EventDispatcher = new EventDispatcher();
>					dispatch.dispatchEvent(eventObject);
>				}
>				Alert.show(updateSuccessMessage);
>			}
>		}
>
>
>
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/result-Handler-fires-but-la
>st-result-does-not-contain-the-correct-data-in-Actionscript-file-tp9018.ht
>ml
>Sent from the Apache Flex Users mailing list archive at Nabble.com.