Hi,
 
It should work without having to convert into to the AS2 type class as you did. If you simply do:
 
results[0].price
results[1].price
 
this should get you the price of the first product and seconds products. I assumed "results" is the name of the object that contains the results of the RO call.
 
Jimmy Gianninas
Software Developer - Optimal Payments Inc.
 


From: Kristopher Schultz [mailto:[EMAIL PROTECTED]
Sent: Monday, March 28, 2005 12:49 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Security Sandbox Violation when loading image

Well, I figured out why I was experiencing different behavior when pulling data in from an XML file vs. pulling it in via a remote object. My remote object method call was returning an Array of objects which on the Java side were instances of a simple data object class I had created called com.myclient.Product. These objects had three properties: label(String), imageId(String), and price(Double) which were accessible through appropriately named getter methods. When stepping through the debugger in Flex Builder, I could see these objects were coming through just fine with the appropriate property names and values, but when I tried to pass each object to my custom display component it was not displaying them, even when the same display component had no problem displaying similar data Objects if they were created in the AS code. So I went ahead and created an .as class called com.myclient.myapp.Product and associated it with the Java class using the following static variable invocation:
 
   static var regClass = Object.registerClass("com.myclient.Product", com.myclient.myapp.Product);
 
After doing that, everything worked just fine.
 
So my questions are, why did I have to create that ActionScript class to get things to work? Is there a way to pass back a generic AS Object from a remote object call? Would passing back objects of type java.util.Map be the answer? Which is the better practice, passing back a java.util.Map to be converted to an untyped Object or creating .as classes for each typed Object that can be retured from a remote object call.
 
Kris
 
--
 
Kristopher Schultz
Developer
 
Resource Interactive
p: 614.410.2123
 

 

The weird thing I've discovered is that if my image paths are brought into my Flex app via an XML file, then I do get the errors above, but the images do load successfully. However, if my image paths come in as a result of a remote object call, I get the same errors and my images DON'T load successfully. I've double checked the exact path's that are being used in both situations by tracing out the path immediately before it is used as the value for the "source" property of the <mx:Image> tag and it is EXACTLY the same in both cases.
 


Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to