RE: [flexcoders] complex Remote Objects
I believe this also necessary when passing typed objects between SWFs using LocalConnection. Dirk. -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] Behalf Of Peter Farland Sent: Thursday, June 09, 2005 6:00 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] complex Remote Objects Yep - Matt's diagnosis is correct. Your OgoPhoneVO constructor might look something like this to make sure it doesn't override the initial states of the deserialized result objects: public function OgoPhoneVO() { if (info === undefined) { info = ; number = ; telephoneId = null; type = ; } } This is necessary for any VO that is expected to be populated from native Flash Player object deserialization, e.g. instances of registered classes from RemoteObject that are encoded using AMF. It's unfortunately that an example of this is not in the Flex 1.5 documentation - the topic will be improved in Flex 2.0. Note: While it's taken me a while to come around on this issue, I personally don't believe this functionality sucks... it is a deliberately designed function of the Flash Player's native object deserialization (be it from LSOs, AMF, RTMP). It allows you to get access to the remote variables during object initialization (as you can't send constructor arguments via AMF). From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Matt Chotin Sent: Wednesday, June 08, 2005 9:12 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] complex Remote Objects Hi Christophe, I bet the bug is because you have the constructor doing initial value assignment. Joe Berkovitz posted a very detailed account of how Flex will screw you up if you do this in your VOs because the constructor is actually called AFTER all the variables have been assigned. Pete then gave an explanation as to why we do this, which I forget. In any case, it sucks. So in your VO objects make sure that you don't assign default values to the properties in your constructor (or if you must put checks in the constructor to make sure the value hasn't already been defined). HTH, Matt From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Christoph Guse Sent: Wednesday, June 08, 2005 10:36 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] complex Remote Objects Hi Peter, I still have the problem with my complex Remote Objects. Here is some code and other stuff: 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 the Yahoo! Terms of Service. 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/
RE: [flexcoders] complex Remote Objects
Also when you desterilizing a object saved in Local SharedObject. -abdul -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dirk Eismann Sent: Friday, June 10, 2005 12:09 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] complex Remote Objects I believe this also necessary when passing typed objects between SWFs using LocalConnection. Dirk. -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] Behalf Of Peter Farland Sent: Thursday, June 09, 2005 6:00 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] complex Remote Objects Yep - Matt's diagnosis is correct. Your OgoPhoneVO constructor might look something like this to make sure it doesn't override the initial states of the deserialized result objects: public function OgoPhoneVO() { if (info === undefined) { info = ; number = ; telephoneId = null; type = ; } } This is necessary for any VO that is expected to be populated from native Flash Player object deserialization, e.g. instances of registered classes from RemoteObject that are encoded using AMF. It's unfortunately that an example of this is not in the Flex 1.5 documentation - the topic will be improved in Flex 2.0. Note: While it's taken me a while to come around on this issue, I personally don't believe this functionality sucks... it is a deliberately designed function of the Flash Player's native object deserialization (be it from LSOs, AMF, RTMP). It allows you to get access to the remote variables during object initialization (as you can't send constructor arguments via AMF). From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Matt Chotin Sent: Wednesday, June 08, 2005 9:12 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] complex Remote Objects Hi Christophe, I bet the bug is because you have the constructor doing initial value assignment. Joe Berkovitz posted a very detailed account of how Flex will screw you up if you do this in your VOs because the constructor is actually called AFTER all the variables have been assigned. Pete then gave an explanation as to why we do this, which I forget. In any case, it sucks. So in your VO objects make sure that you don't assign default values to the properties in your constructor (or if you must put checks in the constructor to make sure the value hasn't already been defined). HTH, Matt From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Christoph Guse Sent: Wednesday, June 08, 2005 10:36 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] complex Remote Objects Hi Peter, I still have the problem with my complex Remote Objects. Here is some code and other stuff: 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 the Yahoo! Terms of Service. Yahoo! Groups Links 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/
Re: [flexcoders] complex Remote Objects
Hi Peter, hi Matt, thank you so much for your help! You are right, it were the initial values in the constructor. I used the initial values becaus of some problems I had with sending VOs to the server with undefined values. I'm sure I can handle that issue. Note: my mail-prog says Peter sent his mail at 5:59 AM. I suppose a time difference of 8 hours, then he sent his answer at 10 PM. Peter, are you married with your work? ;-) Greets from Germany Christoph Peter Farland wrote: Yep - Matt'sdiagnosis is correct.Your OgoPhoneVO constructor might look something like this to make sure it doesn't override the initial states of the deserialized result objects: public function OgoPhoneVO() { if (info === undefined) { info = ""; number = ""; telephoneId = null; type = ""; } } This is necessary for any VO that is expected to be populated from native Flash Player object deserialization, e.g. instances of registered classes from RemoteObject that are encoded using AMF. It's unfortunately that an example of this is not in the Flex 1.5 documentation - the topic will be improved in Flex 2.0. Note: While it's taken me a while to come around on this issue, I personally don'tbelieve this functionality "sucks"... it is a deliberately designedfunction of the Flash Player's native object deserialization (be it from LSOs, AMF, RTMP). It allows you to get access to the remote variables during object initialization (as you can't send constructor arguments via AMF). From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Matt Chotin Sent: Wednesday, June 08, 2005 9:12 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] complex Remote Objects Hi Christophe, I bet the bug is because you have the constructor doing initial value assignment. Joe Berkovitz posted a very detailed account of how Flex will screw you up if you do this in your VOs because the constructor is actually called AFTER all the variables have been assigned. Pete then gave an explanation as to why we do this, which I forget. In any case, it sucks. So in your VO objects make sure that you dont assign default values to the properties in your constructor (or if you must put checks in the constructor to make sure the value hasnt already been defined). HTH, Matt From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Christoph Guse Sent: Wednesday, June 08, 2005 10:36 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] complex Remote Objects Hi Peter, I still have the problem with my complex Remote Objects. Here is some code and other stuff: -- Christoph Guse Lhstrae 34 41747 Viersen Tel. 0 21 62 / 50 24 066 Mobil 01 72 / 160 74 84 VoIP 0 12 12 / 39 64 48 831 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 the Yahoo! Terms of Service.
RE: [flexcoders] complex Remote Objects
Hi, Maybe you left it out in your example, but do you have the DataGridColumn tags? Like so: mx:DataGrid width="436" height="100%" mx:dataProvider {person.phones} /mx:dataProvider mx:columns mx:Array mx:DataGridColumn headerText="number" width="125" labelFunction="zip"/ mx:DataGridColumn headerText="info" width="125" columnName="name1" / mx:DataGridColumn headerText="type" columnName="type" / /mx:Array /mx:columns /mx:DataGrid Perhaps you should show us the piece of code that sets the dataProvider of the DataGrid. I think the problem lies there. Dimitrios "Jimmy" Gianninas RIADeveloper Optimal Payments Inc. From: Christoph Guse [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 08, 2005 1:36 PMTo: flexcoders@yahoogroups.comSubject: Re: [flexcoders] complex Remote Objects Hi Peter,I still have the problem with my complex Remote Objects. Here is some code and other stuff:Output:Implementation in MXML: mx:DataGrid width="436" height="100%" mx:dataProvider {person.phones} /mx:dataProvider /mx:DataGridInput in person from remote method:Info: Serializing response (Message #0 targetURI=/7/onResult, responseURI=null) (Typed Object #0 'ogo.vo.OgoPersonVO') addresses = (Array #1) [0] = (Typed Object #2 'ogo.vo.OgoAdressVO') country = "Deutschland" type = "location" street = "Albertus-Magnus-Weg 16" name2 = "Standortadresse" _remoteClass = "ogo.vo.OgoAdressVO" state = "NRW" name3 = "name3" zip = "48565" name1 = "Henning Guse" city = "Steinfurt" id = "skyrix://renner.flex/default/10710" [1] = (Typed Object #3 'ogo.vo.OgoAdressVO') country = "Deutschland" type = "private" street = "Albertus-Magnus-Weg 16" name2 = "Privatadresse" _remoteClass = "ogo.vo.OgoAdressVO" state = "NRW" name3 = "name3" zip = "48565" name1 = "Henning Guse" city = "Steinfurt" id = "skyrix://renner.flex/default/10690" [2] = (Typed Object #4 'ogo.vo.OgoAdressVO') country = "Deutschland" type = "mailing" street = "Albertus-Magnus-Weg 16" name2 = "Postadresse" _remoteClass = "ogo.vo.OgoAdressVO" state = "NRW" name3 = "name3" zip = "48565" name1 = "Henning Guse" city = "Steinfurt" id = "skyrix://renner.flex/default/10700" objectVersion = 32.0 isComplete = true jobTitle = "Vater" login = "OGo10610" _remoteClass = "ogo.vo.OgoPersonVO" lastChanged = Sat May 28 14:04:04 CEST 2005 salutation = "06_geehrt_herr" comment = "hier kommt die Bemerkung rein" id = "skyrix://renner.flex/default/10610" vorname = "Henning" phones = (Array #5) [0] = (Typed Object #6 'ogo.vo.OgoPhoneVO') info = "privat" telephoneId = 10770.0 type = "01_tel" _remoteClass = "ogo.vo.OgoPhoneVO" number = "02552-996021" [1] = (Typed Object #7 'ogo.vo.OgoPhoneVO') info = "auch privat" telephoneId = 10740.0 type = "02_tel" _remoteClass = "ogo.vo.OgoPhoneVO" number = "02552-996023" [2] = (Typed Object #8 'ogo.vo.OgoPhoneVO') info = "mobilinfo" telephoneId = 10760.0 type = "03_tel_funk" _remoteClass = "ogo.vo.OgoPhoneVO" number = "mobil" [3] = (Typed Object #9 'ogo.vo.OgoPhoneVO') info = " tel privat info" telephoneId = 10750.0 type = "05_tel_private" _remoteClass = "ogo.vo.OgoPhoneVO" number = "tel privat" [4] = (Typed Object #10 'ogo.vo.OgoPhoneVO') info = "fax info" telephoneId = 10730.0 type = "10_fax" _remoteClass = "ogo.vo.OgoPhoneVO" number = "fax" [5] = (Typed Object #11 'ogo.vo.OgoPhoneVO') info = "fax privat info" telephoneId = 10720.0 type = "15_fax_private" _remoteClass = "ogo.vo.OgoPhoneVO" number = "fax privat" email1 = "[EMAIL PROTECTED]" url = "" class=moz-txt-link-rfc2396E href="http://guse.conquer.de">"http://guse.conquer.de" degree = "keiner" phoneTypes = (Array #12) [0] = "01_tel" [1] = "02_tel" [2] = "03_tel_funk" [3] = "05_tel_private" [4] = "10_fax" [5] = "15_fax_private" otherTitle2 = "Pferdeheld" number = "OGo10610" email2 = "[EMAIL PROTECTED]" nickname = "Henna" gender = "male" owner = (Typed Object #13 'ogo.vo.OgoMinimalPersonVO') login = "knuffel" _remoteClass = "ogo.vo.OgoMinimalP
RE: [flexcoders] complex Remote Objects
Hi Christophe, I bet the bug is because you have the constructor doing initial value assignment. Joe Berkovitz posted a very detailed account of how Flex will screw you up if you do this in your VOs because the constructor is actually called AFTER all the variables have been assigned. Pete then gave an explanation as to why we do this, which I forget. In any case, it sucks. So in your VO objects make sure that you dont assign default values to the properties in your constructor (or if you must put checks in the constructor to make sure the value hasnt already been defined). HTH, Matt From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Christoph Guse Sent: Wednesday, June 08, 2005 10:36 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] complex Remote Objects Hi Peter, I still have the problem with my complex Remote Objects. Here is some code and other stuff: 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 the Yahoo! Terms of Service.
RE: [flexcoders] complex Remote Objects
Yep - Matt'sdiagnosis is correct.Your OgoPhoneVO constructor might look something like this to make sure it doesn't override the initial states of the deserialized result objects: public function OgoPhoneVO() { if (info === undefined) { info = ""; number = ""; telephoneId = null; type = ""; } } This is necessary for any VO that is expected to be populated from native Flash Player object deserialization, e.g. instances of registered classes from RemoteObject that are encoded using AMF. It's unfortunately that an example of this is not in the Flex 1.5 documentation - the topic will be improved in Flex 2.0. Note: While it's taken me a while to come around on this issue, I personally don'tbelieve this functionality "sucks"... it is a deliberately designedfunction of the Flash Player's native object deserialization (be it from LSOs, AMF, RTMP). It allows you to get access to the remote variables during object initialization (as you can't send constructor arguments via AMF). From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Matt ChotinSent: Wednesday, June 08, 2005 9:12 PMTo: flexcoders@yahoogroups.comSubject: RE: [flexcoders] complex Remote Objects Hi Christophe, I bet the bug is because you have the constructor doing initial value assignment. Joe Berkovitz posted a very detailed account of how Flex will screw you up if you do this in your VOs because the constructor is actually called AFTER all the variables have been assigned. Pete then gave an explanation as to why we do this, which I forget. In any case, it sucks. So in your VO objects make sure that you dont assign default values to the properties in your constructor (or if you must put checks in the constructor to make sure the value hasnt already been defined). HTH, Matt From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Christoph GuseSent: Wednesday, June 08, 2005 10:36 AMTo: flexcoders@yahoogroups.comSubject: Re: [flexcoders] complex Remote Objects Hi Peter,I still have the problem with my complex Remote Objects. Here is some code and other stuff: 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 the Yahoo! Terms of Service.
Re: [flexcoders] complex Remote Objects
Hi Peter, I've used Object.registerClass on Phones and Person. I didn't really test if the type information is lost. But if I access an Array member directly, i.e. ApplicationPerson.phones[0].number I get a warning: 1 Warning found. Warning /WEB-INF/flex/user_classes/personen/PersonInfo.mxml:171 Changes to unknown property, number, will not be detected. 170: 171: mx:Label text={ApplicationPerson.phones[0].number} / 172: Despite this warning the access works and gets a result. I have checked my VOs several times and I took the variables of of what Java2AS generates. The flat-cast-phenomenon occurs in my app only with arrays. If I put another custom object in Person I can access it without any problem. Greets Christoph Peter Farland wrote: If you've used Object.registerClass on both Phones and Person classes there should be no problem with them being returned in an Array (that is, the Flash Player creates the Phones instances during deserialization no matter how deeply nested). When you say: There are objects in ApplicationPerson.phones but it seems the information which type of objects are in it is gone. How do you test that this type information is lost? You could add a method to the Phones class, such as: class Phones{ public var number:String; public var info:String; public function test():String { return (My info is: + info); } } Then call .test() on an Array member that is supposed to be of type Phones - if the call succeeds then you have an instance of Phones, if not, then perhaps you just have a generic Object. If the call did succeed, then perhaps you've uncovered a bug (possibly in DataGrid and its interaction with deserialized objects)? Let me know how the test goes and I'll pass on to QA to test. -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Christoph Guse Sent: Friday, June 03, 2005 10:50 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] complex Remote Objects Hi List, I use some complex Remote Objects. Let me give an example: class Phones{ public var number:String; public var info:String; } class Person{ public var name:String; public var firstname:String; public var phones:Array; } These are only example classes. In my app they are more complex and of course I uses Object.registerClass(). The phones array in the Person class contains some Phones Objects. Let's say I have a Person object ApplicationPerson in my app and ApplicationPerson is filled with values by a remote call. There is absolutely no problem to access ApplicationPerson.name and ApplicationPerson.firstname, but when I try to fill a DataGrid with ApplicationPerson.phones nothing is shown. There are objects in ApplicationPerson.phones but it seems the information which type of objects are in it is gone. The only possibility I found to access ApplicationPerson.phones is to put a getPhones method in the class Person in which I cast every item in phones. getPhones could look like this: public function getPhones():Array{ var ret:Array = new Array(); for(var i=0; i phones.length; i++){ ret.push(Phones(phones[i]); } return ret; } Is a explicit getter-method the onliest chance to deal with complex Remote Objects or is there a possibility of deep-cast Flex does on its own? Greets Christoph -- Christoph Guse Löhstraße 34 41747 Viersen Tel. 0 21 62 / 50 24 066 Mobil 01 72 / 160 74 84 VoIP 0 12 12 / 39 64 48 831 Yahoo! Groups Links *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] mailto:[EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service http://docs.yahoo.com/info/terms/. -- Christoph Guse Löhstraße 34 41747 Viersen Tel. 0 21 62 / 50 24 066 Mobil 01 72 / 160 74 84 VoIP 0 12 12 / 39 64 48 831 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/