Welcome, Guest. Please login or register.
Did you miss your activation email?
02/08/12, 14:34
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  General
| |-+  Flex, Air, FlashBuilder, Catalyst (Moderators: ..:: Mazhar Hasan ::.., kofi addaquay)
| | |-+  Accessing returned objects
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Accessing returned objects  (Read 2182 times)
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« on: 07/25/10, 06:30 »

I have a little project, displaying and processing data from a webshop.

I got stuck, because I oversee something. As more I look, the less I see Wink

If have this declaration:
Code:
<productsservice:ProductsService id="productsService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
<s:CallResponder id="userLoginResult" fault="Alert.show('Anmeldung ist fehlgeschlagen','Systemmeldung')" result="login_result(userLoginResult)"/>
<s:CallResponder id="articleSearchResult" fault="Alert.show('Abfrage ist fehlgeschlagen\n'+event.fault.faultDetail,'Fehlermeldung')" result="listResult(articleSearchResult)" />
<s:CallResponder id="getProductDetailsResult" fault="Alert.show('Abfrage ist fehlgeschlagen\n'+event.fault.faultDetail,'Fehlermeldung')" result="displayProduct(getProductDetailsResult)"/>

the first two work perfectly as expected.
But the displayProduct function is never called.

If I watch this in Charles, data is received as expected, but never displayed.
The debugger does not want to communicate, which does not make it easyer.

Code:
getProductDetailsResult.lastResult.data.products_ean
this passes the compiler ok, but never receives any data, even though the data is there (as Charles says).
Logged

happy flashing
Cool
Ronald
papachan
Systems Administrator
*****
Posts: 507


View Profile WWW
« Reply #1 on: 07/26/10, 08:09 »

when the things gone to fast, i generally use a setTimeOut function, it generally help the flash player in some cases.
Logged

kofi addaquay
Global Moderator
Senior Programmer
*****
Posts: 450



View Profile WWW Email
« Reply #2 on: 07/26/10, 17:11 »

very weird indeed !

did you get this solved? what does your displayProduct function look like?
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #3 on: 07/27/10, 02:44 »

I striped the function down to only show a message box.
It is not even called.

Accessing the lastResult ends in empty values, even though I see the values in Charles exactly as expected.
Code:
protected function displayProduct(p:CallResponder):void{
//Alert.show(p.lastResult.data.products_price,"Preisinfo");
//this.productDetail=p.lastResult.data;
//Alert.show(this.productDetail.products_name,"Debuginfo");
Alert.show("Daten empfangen","Debug");
}

and the result screen of Charles delivers:
Code:
body Object
data Object
err Integer 0
msg String 1 Datensätze gefunden.
Data opened:
Code:
products_id String 3334
products_ean String 8436032420035
products_quantity String 9
products_shippingtime String 1
products_model String OCC-13600
...
Logged

happy flashing
Cool
Ronald
kofi addaquay
Global Moderator
Senior Programmer
*****
Posts: 450



View Profile WWW Email
« Reply #4 on: 07/27/10, 10:07 »

still hard to see Cheesy

where are you calling your send()?

are you using httpservice anywhere?
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #5 on: 07/27/10, 10:27 »

It is called, when you click into a datagrid:

<mx:DataGrid id="productList" x="10" y="173" width="555" height="284" editable="false" click="getProductDetails(productList.selectedItem.products_id)">

Code:
protected function getProductDetails(pid:int):void{
Alert.show("Nach Artikel "+pid+" wird gesucht","Info");
getProductDetailsResult.token = productsService.getProductDetails(pid);
selector.selectedItem=productDetails;
}

This function is definately called, because the selector (its a tabbed controll) changes, and as I mentioned, Charles does deliver the expected data.
« Last Edit: 07/27/10, 10:28 by Ronald Wernecke » Logged

happy flashing
Cool
Ronald
kofi addaquay
Global Moderator
Senior Programmer
*****
Posts: 450



View Profile WWW Email
« Reply #6 on: 07/27/10, 10:55 »

yes its being called one way...and not returning..

not sure...the first thing that comes to mind is your result handler function displayProduct..because that is what gets fired when data comes to flex

the function taking a parameter p of type CallResponder (p:CallResponder). i think this is wrong:) it should be ResultEvent. did you try that?
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #7 on: 07/27/10, 11:50 »

I tried this - it definately delivers a object of the type mx.rpc:CallResponder

Error message says - cannot convert CallResponder to incompatible ResultEvent

And the other services work, which are written the same way.

The call itself works - I can see the result in Charles
Logged

happy flashing
Cool
Ronald
kofi addaquay
Global Moderator
Senior Programmer
*****
Posts: 450



View Profile WWW Email
« Reply #8 on: 07/27/10, 11:59 »

Hmm... have you tried skipping mxml entirely for that one service and using actionscript instead?

have you used the ItemResponder and AsynToken method to try and solve this problem?
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #9 on: 07/27/10, 13:59 »

Nope - i have hoped, you can see a typo, i didnt find Wink
I can't think of anything else, because the other routines are working perfectly.

But I think, I have to reinstall Flex, to make the debugger running.
This is the last chance to find the bug.

Sure, it might be even better to encapsulate the service calls in a AS-Class.
Logged

happy flashing
Cool
Ronald
kofi addaquay
Global Moderator
Senior Programmer
*****
Posts: 450



View Profile WWW Email
« Reply #10 on: 07/27/10, 14:04 »

yes i hate it when things like that happen

you know very well that it should work...but it doesnt. Angry try the actionscript way. if it doesnt work... you can try your reinstall. let me know if you need help in the ItemResponder and AsynToken way of doing it. But you should be able to do it easy !

Kofi
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #11 on: 08/01/10, 15:39 »

you are right - I got lost in all these new classes Wink
It looks, like they over complicated some simple things.
I got to get deeper into these classes.
Most examples use combinations of MXML and AS, which seam to make trouble in my case.
Logged

happy flashing
Cool
Ronald
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything