Search code examples
actionscript-3apache-flexflash-builder

How To Pass Multiple 'Datas' To A View?


I know that you can pass data to a view using:

navigator.pushView(views.LoadoutView, list.selectedItem)

But what if I pass that data, and then want to pass another piece of data to the same view using a similar method?

Can I get/set a new property or can I write the current data to an xml file as soon as it is received?

Here is a little diagram I made of what I'm trying to achieve (I spent hours on it :P).

enter image description here


Solution

  • From what I've understood, you need to push multiple objects to a view at once, correct?

    The data object can only be a single object or object reference, which means that if you want to push more than just your list.selectedItem, create a new Object (a generic one will do) that contains both your properties and push it, much like the following;

    var myDataObject:Object = {firstPieceOfData:list.selectedItem, secondPieceOfData:yourSecondObjectHere};
    navigator.pushView(views.LoadoutView, myDataObject);