flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manohar Jeyaraj <manum...@gmail.com>
Subject Re: Not able to pass Object from stagewebview to javascript function
Date Tue, 10 Nov 2015 11:06:16 GMT
Hi,

Thanks Alex and Jude for the prompt reply. I tried with stagewebview
wrapper it is working fine in simulator but not in ipad.
Let me explain briefly.

What I am trying to achieve is showing a polygon as a border for a
particular state in a country based on geojson data file.
https://google-developers.appspot.com/maps/documentation/javascript/examples/layer-data-dragndrop

In the link above, if we drag and drop a geojson file of any geography,
that particular region gets highlighted with a polygon.

I am trying to achieve same thing by passing the geography\state code from
flex to html google map's javascript function.

I am using tabbed view mobile flex application where i have a list(of
various states of a particular country) and displaying Google Map (which is
Google Map javascript api HTML page).
On change of list i am calling the stagewebview wrapper as Jude suggested
(webview.callJavaScript('myfunction',null,str)) and the selected
value(which is the selected state's code) is being passed to html page and
it is working fine in the simulator as in the screenshot below link:

http://pasteboard.co/21UN0O5N.png

But when i deploy the code and run the ipa file in ipad the geography wont
be marked like in the screenshot above and it will display only the empty
map as in the screenshot below link:

http://pasteboard.co/21Vf22LR.png

This is the html page(code) that I am using within stagewebview:

http://codepen.io/anon/pen/zvMBaz

On selecting the list, i am calling following javascript function from flex:
function myfunction(str)
{
    //alert(str);
    loadJSON("./"+str+".geojson", function(response) {});   // this loads
the geojson file which has lat\long points that needs to be shown on the map
}

Kindly let me know if i am missing anything or anything is wrong?.



On Tue, Nov 10, 2015 at 4:09 AM, jude [via Apache Flex Users] <
ml-node+s2333346n11451h55@n4.nabble.com> wrote:

> Manohar,
>
> Try this stagewebview wrapper,
>
> https://github.com/monkeypunch3/flexcapacitor/blob/master/MainMobileLibrary/src/com/flexcapacitor/controls/WebView.as.
>
> You would pass objects as stringified JSON as Alex mentioned. FYI In the
> latest Android a user reported you must add a fake protocol to get the
> event to fire, https://github.com/monkeypunch3/flexcapacitor/issues/1.
>
> On Mon, Nov 9, 2015 at 8:38 AM, Alex Harui <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=11451&i=0>> wrote:
>
> > Is your JS function being called, but just not with the right value?
> >
> > If so, I would just JSON to stringify the object.
> >
> > -Alex
> >
> > On 11/9/15, 3:42 AM, "Manohar Jeyaraj" <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=11451&i=1>> wrote:
> >
> > >ExternalInterface is not available as I am using this in mobile
> > >application. Hence I am using stagewebview.
> > >
> > >I am using stagewebview(to display HTML Google map)  to call a
> javascript
> > >function in flex mobile application.
> > >I am passing a selected item value(from flex) to a javascript function
> > >like
> > >below:
> > >
> > >webView.loadURL(“javascript:myfunction(‘” + lst.selectedItem[‘name’]
+
> > >“‘)”);
> > >
> > >and in my html file  when i add an alert i am getting the value too.
> > >
> > >But the problem is that the required function is working only when i
> add
> > >it
> > >under onload in body as below:
> > >
> > ><body onload="myfunction('value')">
> > >
> > >but when i remove the onload method from the body of html and call it
> from
> > >flex the required action is not happening inside the JS function.
> > >
> > >Kindly help me out on what is causing the issue?
> >
> >
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-flex-users.2333346.n4.nabble.com/Not-able-to-pass-Object-from-stagewebview-to-javascript-function-tp11376p11451.html
> To start a new topic under Apache Flex Users, email
> ml-node+s2333346n1h5@n4.nabble.com
> To unsubscribe from Apache Flex Users, click here
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1&code=bWFudW1lOThAZ21haWwuY29tfDF8LTEyNjk1NDc3NTE=>
> .
> NAML
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 
~M@nU~

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