PDA

View Full Version : RemoteObject and ViewStack


vilraj
04-13-2008, 03:56 PM
I am working on a E-Commerce application and I am wanting to use ViewStacks for the individual product pages, checkout, etc. and I have all of this working.

Now, I am having a problem of getting data into these ViewStacks. I am using a Coldfusion CFC to get the information from the database and I can successfully do that, but how do I get this information into each individual ViewStack.

I am not able to use ArrayCollection because I am returning an Object. I was looking at the Flex Store Example on the Adobe website and I am lost about how they get the variables in. I know I can use AS, but not really sure where to start.

Any thoughts? I can post code if needed.

vilraj
04-13-2008, 10:12 PM
Ok, well never mind. I used:

[Bindable]
private var productList:ArrayCollection;

private function returnHandler(event:ResultEvent):void {
productList = event.result as ArrayCollection;
}

And I was able to get it to work properly. Coldfusion brings back queries in the RemoteObject as an ArrayCollection and you can set it up that way and then utilize that information.

It was staring me right in the face, and I did not realize it. The original reason I said that it was not working is because I forgot to do "[Bindable]" and make the productList:ArrayCollection be a "private var"

From there, you can access the data by setting the properties in Actionscript, like I am going to do and just read the actionscript file from any ViewStack container you need to use, BUT make sure you package the information and call that at the beginning of your <mx:Script> tag.