creating a picture frame

0 favourites
  • 7 posts
From the Asset Store
An educational game for counting pictures. An easy to use template for developers to build larger games
  • Hello,

    I'd like to create a simplest app running locally on an android tablet that does exactly one thing.

    It reads from a local folder (which happens to be a dropbox folder) and displays in full screen the one picture stored in the folder.

    When the picture in the folder changes, then the new picture is displayed in full screen.

    I can see that the nw.js plugin allows me to read a binary file -- which would be the picture file (in some picture format) -- but i am unsure how to get the picture displayed e.g. in a sprite or elsewhere.

    Edit: looks like sprite can load from a URL -- but, can it also load from a local folder?

    Any thoughts on this are much appreciated,

    Dan

  • If you are using the Nw.js read

    Then what you do is:

    1-Nw.js read Binary File into the binary data Plugin

    2-Wait for previous action to complete

    3-Here as you say that you need to save the image to load any other time then you can save it as Base64 into an Array, Dictionary, etc...And whenever you want to load the image just load it from that base64 that you saved.

    Note:

    If you just wanna save it in Local Storage then you don't need to convert it to base64 as you can just save it as binary data

  • Thanks.

    My apologies, I wasn't clear.

    I want to load the image into a sprite and i don't want to save it for loading again.

    Instead, when i (somehow) sense that the image was replaced in the folder with a new image, then i want to load the new image into the sprite.

    And, as mentioned, the simplest case i am looking at right now is that there always only exists one image in the folder which is displayed on screen.

  • Instead, when i (somehow) sense that the image was replaced in the folder with a new image, then i want to load the new image into the sprite.

    And, as mentioned, the simplest case i am looking at right now is that there always only exists one image in the folder which is displayed on screen.

    app running locally on an android tablet

    Nw.js only works for Pc

    It reads from a local folder (which happens to be a dropbox folder)

    For that, you gonna need a third-party plugin I believe not sure if there is any for C3, I think there used to be one for c2 but not really sure.

    The best solution is to work with local storage so you can save the Image and have control over when they replace it, this option will much easier to do.

    Though if you need to update the image for them then it may be better to have it in a server and use Ajax to load the Picture.

    Let's see if someone else has a better idea of how to work with DropBox so it can help you, I personally never used it.

  • thanks.

    I now tried two approaches and neither worked:

    1. use the load image method for sprite, to load a URL of the image in the dropbox.

    2. use nw.js to load binary data from a URL -- such a method exists, and its loaded into a binary data object --

    and then, upon read event completed load the sprite with a URL of the binary data generated by the binary data object's method get URL ...

    Also, this didn't work.

    The sprite remains unchanged, upon loading the layout ...

    Not sure what the problem is ... the URL works in the browser to retrieve the image from the dropbox.

    I am missing something ...

    Dan

  • Dropbox drop support for host files many years ago as people used to abuse hosting games etc... in there so now they block that feature as you will get now:

    "blocked by CORS policy: No 'Access-Control-Allow-Origin' header "

    The best option is to find a free hosting service and upload your image there and use AJAX

    Here is how you load an image into a sprite using AJAX

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • thank you.

    Yes, i started to suspect that dropbox is the culpit after installing remote image plugin and noticed it works fine unless i put in the dropbox url.

    What is odd is that dropbox allows sharing the link and everyone with the link can view it -- so it views in my browser but doesnt in the opened runtime browser of C3.

    too bad dropbox is more convenient than say google drive or one drive.

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