0

After executing a navigator.pushView with data object, I'm in need of the data object to be received into the next view, but at some stage transformed into a string to use in a sql function. The code below shows what I'm working on at the moment.

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark" title="{data.toString()}"
    xmlns:model="model.*"
    creationComplete  = "{data=srv.findByCategory(data.toString())}"
    >

.toString() was my quick attempt at it, but the resultant output is simply

[object Object]

There aren't any errors but it only shows during debug.

Any ideas?


As appendage, here is the code from the initial view where the data object originates from

<s:List id="list" top="0" bottom="0" left="0" right="0" width="100%"
        alternatingItemColors="0xffffff"
        contentBackgroundColor="0xffffff"
        downColor="0xfc7d1a"
        selectionColor="0xfc7d1a"           
        dataProvider="{data}"
        labelFunction="getFullName"
        change="navigator.pushView(CategoryView, list.selectedItem.toString())">

And here is some of the code which needs the data object to be a String.

public function findByCategory(searchKey:String):ArrayCollection
        {
}
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Pete
  • 683
  • 1
  • 8
  • 17

1 Answers1

0

data is a keyed object containing containing the info you passed from the initial view. You need to access the correct key in your object.

It should be something like data.myKey.toString(). I would be able to tell you exactly if you paste your pushView code.

francis
  • 5,889
  • 3
  • 27
  • 51
  • ' ' Thanks for the answer, I'll look around as well. Let me know if this is or isn't what you were after. – Pete May 07 '12 at 13:45
  • @Pat so you would be able to access the data in this view the same way you do in your list – francis May 07 '12 at 13:49