Invoking a javascript command

0 favourites
  • 9 posts
From the Asset Store
In this game you will command the character by voice command.
  • Is there a way to invoke a javascript command without having to write a plugin? Basically what I plan on doing is building my own chrome based wrapper for Android. Within the Android SDK there is a way to call commands to the java level using Javascript commands (and its quite simple to set up)

    So I'm curious if I could call these commands within Construct somehow.

  • The C2 Manual describes calling Javascript using the Browser plugin.

  • Thanks much! I now have C2 talking to Android's java code. Much easier than I thought it would be.

  • Just a heads up that performance will likely be really bad if you make your own wrapper.

  • The newest version of the Android SDK uses Chrome instead of WebView, although its only for 4.4 devices.

    There is an open source Chrome Webview though which I've been looking at. Seems like performance using Chrome over the network is pretty solid for the most part

  • I guess this will be part 2

    Is there anyway for the Javascript to return its value back into Construct 2? What would be the best way to achieve this? Lets say for example, I have a javascript popup box ask me for text input. How would I get that value and set it to a text object?

  • You should use the Javascript SDK for anything beyond simple one-liners. You can also execute javascript in the ExecJS expression and have the result returned.

    The Chrome web view in 4.4 is still very slow due to some bugs - we've tried it. Crosswalk is the Chrome-powered web view you are looking for, and it is backed by Intel.

  • Understood on the web view. The only reason I would want to write my own wrapper is to utilize the Ouya IAP store. As far as I understand, there isn't any native way to utilize it at this point. You would need access to the java code to make those API calls if I'm not mistaken

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • just to answer how to store data into a C2 var using Browser.

    Action:

    set variable name: Browser.execJS("

    var ret;

    ret = 100 * 100;

    ret;

    ")

    you might be able to get away with

    set variable name: Browser.execJS("

    var ret;

    ret = 100 * 100;

    ")

    There is a Cordova plugin for Ouya IAP. There is game called Sticky Sticky that's an HTML5 tech game.

    caou.org/stickysticky

    and the thread there Caou talks about controller and IAP

    forums.ouya.tv/discussion/797/fixed-webview-ouyacontroller

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)