(Hi suzy, firstly, I'm a little confused as to how Kevin Ewok's response turned into your message - are you saying you're having the same issue as Kevin? Let me first comment on Kevin's issue which will provide good background for yours...).
On looking again at the warning Keven is getting from ClassUtil it means that he didn't link in the com.MyPojo class to his SWF... that is, the compiler didn't include the AS class because it wasn't referenced anywhere. Having a dummy variable of com.MyPojo type is one way to cause a dependency on that class to have it compiled and linked in to the SWF. But, furthermore, by using Object.registerClass() you can avoid the ClassUtil issue altogether because the player will attempt to create types for you from the registerd information while processing the AMF response before the ClassUtil gets a chance to look at the result. The ClassUtil is a legacy system from Flex 1.0 SOAP-based RemoteObject (which is not supported in Flex 1.5) where by you could use a special "_remoteClass" property to map client/server types since Object.registerClass wasn't useful for non-AMF communication (i.e. XML transactions are just strings and thus don't' get processed by the player). Since Flex 1.5 RemoteObject only uses AMF, the _remoteClass method is not suggested for Flex 1.5 and you should use Object.registerClass(). Now, for Suzy's question... Essentially what you're looking for here is that Remote POJOs turn into plain old dynamic Objects on the client, right? The problem is that in Flex 1.5 RemoteObject still has the deprecated "_remoteClass" property in the response (which you should be able to see in the AMF trace output). The old ClassUtil is designed to always do this translation for you if it finds the "_remoteClass" property... that is, it expects that typed POJOs map to a corresponding AS type (that must be available at runtime from the SWF). By calling Object.registerClass you could bypass the ClassUtil's translation attempt altogether... and, actually here's an idea, perhaps you can trick the player into registering your remote POJO class to just plain old Object to get a dynamic object back? Pete -----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of suzy lawson Sent: Friday, May 27, 2005 11:44 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Converting Java POJO to Actionscript Errors Hari, Thanks...I'll give this a shot. So my question is, why do I have to write a matching AS class to match my POJO? When I populate my Datagrid from the remote object (arraylist of POJOs), I din't have to write any AS classes. --- "Doodi, Hari - BLS CTR" <[EMAIL PROTECTED]> wrote: > Hi, > First couple of questions - did you register your > POJO with AS class > using Object.registerClass( ) method? > What is the constructor method of you Pojo ? > After both of above are in place(implemented) then > you can create new object > of your POJO type and assign your newly returned > object to it and then add > this new object to your datagrid using > myDataGrid.addItem( ); > > This is what I did..... > AS class looks like > class classes.MyPojo > { > public var myArray:Array; > private static var registered:Boolean = > Object.registerClass("full path > of you java class goes here", classes. MyPojo); > > } > In my MXML.... you can ignore statements which sets > initial attribute > values > function addRow() > { > var oNewItem:Object = new MyPojo (); > oNewItem.adj_num = "12 "; > oNewItem.adj_type = " "; > oNewItem.adj_category = " "; > oNewItem.adj_amt_terms_desc = " Doodi"; > oNewItem.adj_reporter_applied_flag = "N"; > oNewItem.adj_sign = "Additive"; > oNewItem.adj_factor = " "; > oNewItem.adj_order_applied = "12"; > > myDataGrid.addItem(oNewItem); > > focusNewRow(); > doLater(this,"focusNewRow"); > } > Thanks! > Hari > > -----Original Message----- > From: flexcoders@yahoogroups.com > [mailto:[EMAIL PROTECTED] On > Behalf Of suzy lawson > Sent: Friday, May 27, 2005 10:22 AM > To: flexcoders@yahoogroups.com > Subject: RE: [flexcoders] Converting Java POJO to > Actionscript Errors > > Hari- > THanks for your response. I tried that but I got a > compilation error that "there is no method with the > name MyPojo". I suppose that means I have to > manually > write the underlying ActionScript class for my Java > POJO? > > That just seems like a really bad implementation > design b/c if MyPojo Java class changes, then I have > to manually change my ActionScript class. urr...what > am I missing?! > > --- "Doodi, Hari - BLS CTR" <[EMAIL PROTECTED]> wrote: > > Try this..... > > > > <mx:script...> > > var newObj:Object = new MyPojo(); // constructor > of > > your POJO > > function addToGrid() { > > newObj = remoteObj.getNewJob(); > > myDataGrid.addItem(newObj); > > } > > </mx:script> > > > > Thanks! > > Hari > > > > -----Original Message----- > > From: flexcoders@yahoogroups.com > > [mailto:[EMAIL PROTECTED] On > > Behalf Of Kevin Ewok > > Sent: Friday, May 27, 2005 9:46 AM > > To: flexcoders@yahoogroups.com > > Subject: [flexcoders] Converting Java POJO to > > Actionscript Errors > > > > Gang- > > I'm a newbie and all the flexdocs on MM's site > > couldn't give me a > > concrete answer. I have a datagrid that is > populated > > from an ArrayList > > of POJO's (using the remote object). That works > > fine. > > > > I then have another method that is called 30 > seconds > > later then > > returns a single POJO (of the same type from the > > POJOs returned in the > > first method). I then try to add it to my datagrid > > using the > > myDatagrid.addItem(newObj), but I get the below > > debug error. > > > > Warning: Reference to undeclared variable, > > '_global.com.MyPojo' > > at mx_utils_ClassUtil::findClass() > > Warning: valueOf is not a function > > at mx_utils_ClassUtil::getFlexClass() > > > > Is there a special way I need to declare 'newObj' > > (which I pass into > > the datagrid.addItem() method), or do I have to > > explicity write the > > AS-equilavent class of my Java POJO class? > > > > I would think Flex could convert this class for > me, > > but I'm obviously > > missing an important step to add it to the > > datagrid/dataprovider. > > Thanks in advance for your help. > > > > <mx:script...> > > var newObj:Object; > > function addToGrid() { > > newObj = remoteObj.getNewJob(); > > myDataGrid.addItem(newObj); > > } > > </mx:script> > > > > <mx:DataGrid id="myDataGrid" > > dataProvider="{remoteObj.getAll.result}"> > > ... > > > > > > > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Small Business - Try our new Resources site > http://smallbusiness.yahoo.com/resources/ > > > > Yahoo! Groups Links > > > > > > __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new Resources site http://smallbusiness.yahoo.com/resources/ 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/