flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From OmPrakash Muppirala <bigosma...@gmail.com>
Subject Re: Not able to pass Object from stagewebview to javascript function
Date Wed, 28 Oct 2015 18:26:34 GMT
On Wed, Oct 28, 2015 at 9:58 AM, Alex Harui <aharui@adobe.com> wrote:

> Did you try using JSON on both sides to stringify and parse obj?
>

I don't think it is required to stringify an object before passing flash to
JS.

In javascript, try to enumerate the passed object like this:

for (var key in obj)
{
    alert(key);
}


>
> On 10/28/15, 4:00 AM, "Manohar Jeyaraj" <manume98@gmail.com> wrote:
>
> >Hi,
> >
> >My requirement is to pass object from stagewebview to javascript function
> >in HTML page.
> >
> >Below is the sample code in Flex:
> >
> >var obj:Object = new Object();
> >obj.firstName = "Simon";
> >obj.lastName = "Free";
> >webView.loadURL("javascript:myfunction('" + obj + "')");
> >
> >Below is the code of JS function in HTML page:
> >
> >function myfunction(obj)
> >{
> >        var str = obj.lastName;
> >        alert(str);
> > }
> >
> >The alert is showing up as 'undefined' in the application.
> >How to get the exact value of object in javascript? But if I write
> >alert(obj), it will display as [Object Object], which means there is
> >object
> >value there but i am not able to extract it. Kindly let me know if there
> >is
> >any way to extract object data in javascript.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message