Re: [flexcoders] Re: [flexcoder] RemoteClass + ArrayCollection question
Thank you for the suggestion, it worked perfectly. Curtis Barrett On Fri, Jan 30, 2009 at 10:13 AM, Amy wrote: > --- In flexcoders@yahoogroups.com , Curtis > Barrett > wrote: > > > > Right now I'm playing around with the RemoteClass feature with a few > > ActionScript classes. What I've noticed is that if I have a single > object I > > can nest AS classes. So if I have two AS classes foo and bar I can > have the > > following work > > > > [RemoteClass(alias="com.ca.foo.Foo")] > > public class foo > > { > > public var ID:int; > > public something:bar; > > } > > > > this gets converted correctly when I call a function that returns a > foo. > > bar is correctly identified as a bar and is placed as such. > > > > > > Now here's where I've run into trouble. If I try to have an array > of bars I > > can't figure out how to get this to work correctly. Example: > > [RemoteClass(alias="com.ca.foo.Foo")] > > public class foo > > { > > public var ID:int > > [ArrayElementType("MenuItemSetting")] > > public something:ArrayCollection; > > } > > > > This does not work. When I return from the remoteObject call foo > is done > > correctly up to the ArrayCollection. The ArrayCollection has > objects in it > > instead of MenuItemSettings. > > > > Here is the result function that has objects for the > ArrayCollection Items > > > > public function Success(event:ResultEvent):void > > { > > var test:foo; > > > > if(event.result != null) > > { > > test = MenuItemPackage(event.result); > > } > > } > > > > However, here's where it utterly baffles me. In my result function > if I add > > this one line of code to it, the objects for all items in the > collection > > become type bar. > > > > public function Success(event:ResultEvent):void > > { > > var test:foo; > > > > bar(event.result.something[0]); > > > > if(event.result != null) > > { > > test = foo(event.result); > > } > > } > > > > > > I do realize this will have issues if there are no elements in the > > ArrayCollection or if the result is null. What the heck is happing > here? I > > can even put the breakpoint in before the bar(event.result.something > [0]); > > and look at result and it is typed to the bar. > > > > My other question is, can this be done automatically? Or do I need > to leave > > in the bar(event.result.something[0]);? > > > > I'd be inclined to guess that the only hard reference to bar in the > class that calls the service is that one line where you call > bar(event.result.something[0]); > > Try doing this: > > private var dummy:bar; > > And see if that fixes the problem > http://flexdiary.blogspot.com/2008/11/thoughts-on-remoting.html > > HTH; > > Amy > > >
[flexcoders] [flexcoder] RemoteClass + ArrayCollection question
Right now I'm playing around with the RemoteClass feature with a few ActionScript classes. What I've noticed is that if I have a single object I can nest AS classes. So if I have two AS classes foo and bar I can have the following work [RemoteClass(alias="com.ca.foo.Foo")] public class foo { public var ID:int; public something:bar; } this gets converted correctly when I call a function that returns a foo. bar is correctly identified as a bar and is placed as such. Now here's where I've run into trouble. If I try to have an array of bars I can't figure out how to get this to work correctly. Example: [RemoteClass(alias="com.ca.foo.Foo")] public class foo { public var ID:int [ArrayElementType("MenuItemSetting")] public something:ArrayCollection; } This does not work. When I return from the remoteObject call foo is done correctly up to the ArrayCollection. The ArrayCollection has objects in it instead of MenuItemSettings. Here is the result function that has objects for the ArrayCollection Items public function Success(event:ResultEvent):void { var test:foo; if(event.result != null) { test = MenuItemPackage(event.result); } } However, here's where it utterly baffles me. In my result function if I add this one line of code to it, the objects for all items in the collection become type bar. public function Success(event:ResultEvent):void { var test:foo; bar(event.result.something[0]); if(event.result != null) { test = foo(event.result); } } I do realize this will have issues if there are no elements in the ArrayCollection or if the result is null. What the heck is happing here? I can even put the breakpoint in before the bar(event.result.something[0]); and look at result and it is typed to the bar. My other question is, can this be done automatically? Or do I need to leave in the bar(event.result.something[0]);? Thanks for the help.
[flexcoders] Flex Builder debugger problems
I'm running into an odd problem with the Flex Builder debugger. About 4/5ths of the times that I click the debug button I get a nice, white IE page. It has the loading icon down at the bottom and aside from that, nothing. When I click stop in flex builder the page goes away and when I click disconnect then the page finishes loading my flex app. It is starting to get particularly frustrating when I have to stop it and relaunch it 5-9 times before I get a working window. Once it comes up all is fine and dandy. Has anyone had anything similar happen? I am on a trial version of flex builder and I have reinstalled it to see if it would help at all. Thanks in advanced, Curtis Barrett