Even if it is an ArrayCollection, it should come through on the JS side as
an Object.   No need to encode it as a string first.  You will be able to
walk through it in JS. But you will lose all type information, so you will
have to account for that in the JS code.

AS:
protected function application1_initializeHandler(event:FlexEvent):void
{
var employees:Array = [
{ firstName:"Joe", lastName:"Doe", age:25, isFullTime:true},
{ firstName:"Ann", lastName:"Cavanah", age:28, isFullTime:false}
];
var ac:ArrayCollection = new ArrayCollection(employees);
ExternalInterface.call("passDataToJS", ac);
}

JS:

function passDataToJS(obj)
{
     console.log(obj.source[i].firstName + ", " + obj.source[i].lastName +
", " + obj.source[i].age);
        if(obj.source[i].isFullTime)
        {
        console.log("Employee is fulltime");
        }
        else
        {
        console.log("Employee is not fulltime");
        }
}

Console:
Joe, Doe, 25
Employee is fulltime
Ann, Cavanah, 28
Employee is not fulltime


On Mon, Jun 15, 2015 at 2:18 PM, olegkon <oleg...@gmail.com> wrote:

> Yes, that worked for me too with:
> var jsonStr:Sting = JSON.stringify(employees, null, 4);
>
> But in reality my value object is much more complex
> and includes ArrayCollection children and some boolean (so it fails to
> work).
> Is there a way to customize that conversion function to stringify
> ArrayCollection - encode it into a string?
>
> And if I try to debug it, it fails with source not found.
> How can I add a Flex 4.6 source into FB4.5.1?
>
>
> Please advise.
>
>
>
>
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/Fwd-Adding-JS-graph-to-Flex-project-tp10537p10591.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Reply via email to