Grimmy's Forum Posts

  • I am trying to use an external api that sends an image file to a url but I hve no idea how I can refernce a file from construct to the javascript function.

    The js function has something like this:

    var input = document.getElementById('file_in');

    const file = input.files[0];

    var fr = new FileReader();

    ..and then goes on to perform an api call with this data.

    However, I have no idea how to pass a (binary?) file into this js script from the event sheet. Seems I can only pass in strings and numbers(?)

    ..or If its even possible at all.

    Any pointers greatly appreciated.

  • In my case data.json was a file that I had created manually and put in my files directory. Maybe you speak of another data.json file that lives somewhere else?

  • Something like this?

    CONDITION
    
    If I am moving..
    
    	SUB CONDITIONS
    		..and i am in car..
    			..do this..
    		..and i am on a bicycle
    			..do this..
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In the end it was because I had a file named data.json which seemed to be causing the failure to run on device.

    Once i removed that..everything was fine.

    Naming clash?

  • Apologies to Aekiro. In the end the issue I was having had nothing to do with ProUi.

    That fact that I had a file named data.json seemed to be causing the failure to run on device.

    I can confirm that ProUI is actually very awesome and so to is the support! :)

  • I can confirm that this doesn't work on device (Android). I had a dialogue box and a couple of grid scrollers which work perfectly in preview but when exported to a debug.apk would hang on the start.

    I deleted the ProUI plugin AND all instances of the grid scroller and dialogue box so there was no longer any trace of ProUI and the app runs fine again. I made no other changes to the project, infact I spent all day with this initially deleting all other plugins to track down the issue. ProUI was the last thing I removed.

    The only error I got while remotely debugging on device was:

    Uncaught (in promise) TypeError: Cannot read property '0' of undefined
     at C3.Runtime._LoadDataJson (scripts/c3runtime.js:454)
     at C3.Runtime.Init (scripts/c3runtime.js:454)
     at async f._InitDOM (main.js:5)
     at async f._Init (main.js:5)
    

    I think that's pretty vague, but it might help you.

    Hopefully you can fix this issue soon!!

    Let me know! Thanks

    Simon

  • I just had a similar issue. When it wouldn't install my projects settings were...

    ID: com.ruleoffun.test
    Email: I had none set
    
    

    but then I changed them to..

    ID: com.ruleoffun.someothername
    Email: 

    simonnfj@myactualemail.com

    ..and now the app installed fine.

    Not sure if it was a random fluke but something else to try if you're having the same issue..

  • Has this been tested on an Android APK on device? It should work right? I installed it the other day but now on my device the app freezes at startup.

    It 'may' be this plugin (I hope not) but I wondered if you could confirm that it 'should' work before I start deleting things.

    Cheers

  • I also see this error:

    Not allowed to load local resource: file:///android_asset/www/icons/icon-256.png

    ..but I havent changed the icons at all. They are the default ones that come with a C3 new project .

    ?

  • Wow, I never knew we could do this! AMazing!

    However I have no idea what this error means:

    Uncaught (in promise) TypeError: Cannot read property '0' of undefined

    at C3.Runtime._LoadDataJson (c3runtime.js:454)

    at C3.Runtime.Init (c3runtime.js:454)

    at async f._InitDOM (main.js:5)

    at async f._Init (main.js:5)

  • Hi, nothing more to say really, the title says it all, I don't have any mimyfying or anything. I'm trying to run a debug .apk

    Is there some way to debug? Seems odd it works fine in preview and not on device.

    Any guidance much appreciated.

    Thanks

  • In the end it seems I can only use JSON Set to insert data without the formatting. AFAIK.

    This actually works out to be a neater way in the end anyway as I can use it to adds large chunks of data at once.

  • Awesome! Thanks!

  • dop2000, this converts the string but how do i download it as a file like with the other methods? (They open a save file dialogue when called)

  • I am trying to insert additional strings into a JSON file but when I try to insert:

    "{""activity_name"" : ""noname""}"
    

    the resulting JSON looks like..

    {\"activity_name\" : \"noname\"}
    

    I want the end result to be valid JSON..ie

    {"activity_name" : "noname"}
    

    Should I escape the " in some other way for JSON?

    Additionally when I try to insert a complete piece of parsed JSON into the JSON file all " marks are preceded by a \ in the final JSON.

    eg:

    -> JSON_MAIN: Insert JSON_ACTIVITY_MODEL.GetAsBeautifiedString("") into "profile_1.all_activities" at JSON_MAIN.ArraySize("profile_1.all_activities")

    Thanks