User Tag List

Results 1 to 8 of 8

Thread: Correct webview2 object execute snippet format

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Jul 2006
    Location
    London, UK
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Correct webview2 object execute snippet format

    I'm struggling to get the correct format with 'execute snippet' in webview2 and would appreciate some suggestions.
    I'm posting to an LRS system using xapi and this works fine from a webpage using the HTML5 object along with a list of Add String and Add Integer lines plus the Call Function 'send_statement'. The send_statement function is in the webpage.
    However, I can't get it working using the webview2 object for android and exe etc.
    I'm thinking it should be fairly simple provided I can get the format correct. Which I can't.
    So first I use the webview object to load a URL with the js send_statement function in.
    Then I execute a snippet in the webview object ="send_statement" with argument"XX"

    I've tried numerous format for the "XX" but nothing has worked so far. Do I use Newlines or ; etc.
    I'll also need to add strings, integers and Float parameters.
    It would be great if someone has an example of something similar.

  2. #2
    Clickteam Clickteam
    Fernando's Avatar
    Join Date
    Dec 2006
    Posts
    6,561
    Mentioned
    257 Post(s)
    Tagged
    4 Thread(s)
    can you check the example controlform from webview2 and see if it work for you?
    Regards,


    Fernando Vivolo

    ... new things are coming ...

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Jul 2006
    Location
    London, UK
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes I looked at the Fernando but there was not enough detail for what I need to do.
    I'll send you an example as this is for posting results to an LRS which would be a useful example for all educational users.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Jul 2006
    Location
    London, UK
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    example file

    I've attached an example file here.
    This will allow any MMF app to send results to any standard xapi LRS system. So really important for all elearning.
    The html5 version works fine but I canít get the webview2 working.

    The xapi.js file is the standard format provided for the LRS system. The html5 talks directly with this.

    Iíve added a new appxapisend.html for the webview2 object.
    The startapp.ini contains my programs data file but you probably won't need this. PM me if you want to test how it posts to my LRS at yetanalytics.io
    Attached files Attached files

  5. #5
    Clickteam Clickteam
    Fernando's Avatar
    Join Date
    Dec 2006
    Posts
    6,561
    Mentioned
    257 Post(s)
    Tagged
    4 Thread(s)
    Not sure how to use your mfa or test in there, but here is an small example using 3 parameters, first is a string, second an int and third a float.


    press execute is related to a function called SeveralArgsJava
    Attached files Attached files
    Regards,


    Fernando Vivolo

    ... new things are coming ...

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Jul 2006
    Location
    London, UK
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Fernando
    I found some commas that looked like commas but weren't. It now passes all of the data and displays it in an alert box.
    But the following js code does not run within the webview2 object whereas it does when I use the html5 object from a webpage.

    This is in exactly the same js file used for both programs with the same data.
    This probably has nothing to do with the MMF object but any ideas would be greatly appreciated.

    //define the xapi statement being sent
    var statement ={

    "actor": {
    "mbox": actmbox,
    "name": actname,
    "objectType": "Agent"
    },
    "verb": {
    "id": verbId,
    "display": {verb}
    },
    "object": {
    "id": objectId,
    "definition": {
    "name": {"en-US": objname},
    "description": {"en-US": objdescrip}
    },
    "objectType": "Activity"
    },
    "result": {
    "duration": resduration,
    "score": {
    "scaled": respercent,
    "min": 0,
    "max": respossible,
    "raw": rescorrect
    },
    "response" : resresponse
    }

    }; //end statement definition

  7. #7
    Clickteam Clickteam
    Fernando's Avatar
    Join Date
    Dec 2006
    Posts
    6,561
    Mentioned
    257 Post(s)
    Tagged
    4 Thread(s)
    mm you are declaring an Object, webview only handle string, int, float

    so you must convert to string to bring back to Fusion.

    two handy functions

    JSON.stringify(json_obj); // make it string.

    JSON.parse(str_json); // back to JSON object.

    there is only a problem webview consider that each comma represent a different value, which in case of JSON in the field separator. (you may use | and replace back to ' in javascript function using a replace command).


    ================

    forgot to mention all this associated to StrJavaBack button

    check the example, key when sending json to javascript surround it with " and see the replace all function.
    Attached files Attached files
    Regards,


    Fernando Vivolo

    ... new things are coming ...

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Jul 2006
    Location
    London, UK
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Fernando.
    Clearly a few more issues than I had realised.
    I've changed to using PHP with the form post using the getobject. It works this way from HTML5 and phone apps so a nicer solution overall.
    If anyone else needs to post to an xapi LRS system then I'm happy to let them have the PHP file if they PM me here.

Similar Threads

  1. Replies: 0
    Last Post: 24th October 2017, 06:32 PM
  2. Replies: 3
    Last Post: 10th March 2016, 11:59 PM
  3. Execute application with Com+ object
    By DJFuego in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 13th October 2010, 01:02 PM
  4. snippet manager help
    By Zabooza in forum File Archive
    Replies: 4
    Last Post: 8th March 2009, 11:41 PM
  5. Snippet Manager
    By Zabooza in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 8th March 2009, 12:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •