[Plugin] FileReader

0 favourites
From the Asset Store
The I18N (Translation) is a Construct plugin created to translate text in game.
  • Update v1.1 <font color="RED">19/10/2012</font> : bugfixe + load images !

    Here's a new version of the FileReader plugin !

    <img src="https://dl.dropbox.com/u/1412774/FileReaderDemo2/demo1.png" border="0">

    I fixed a bug, and added thee possibility to load an image file :

    <img src="https://dl.dropbox.com/u/1412774/FileReaderDemo2/demo2.png" border="0">

    Useful, for example in Awesomium, where you can't do a drag'n'drop from desktop to add an image to your game (thanks Joannesalfa for the use case <img src="smileys/smiley2.gif" border="0" align="middle">).

    The demo : https://dl.dropbox.com/u/1412774/FileReaderDemo2/index.html

    The capx :

    https://dl.dropbox.com/u/1412774/FileReaderDemo2/FileReaderDemo2.capx

    The plugin : https://dl.dropbox.com/u/1412774/FileReaderDemo2/pode_filereader.1.1r.zip

    _____________________________________________

    In conjonction with the FileSaver plugin, here's a FileReader plugin !

    It should work on relatively new web browsers (there's no easy fallback for older browser, like the FileSaver plugin).

    <img src="http://dl.dropbox.com/u/1412774/FileReaderDemo/demo.png" border="0">

    For the moment, only text file are loaded...

    The demo : http://dl.dropbox.com/u/1412774/FileReaderDemo/index.html

    The capx :

    http://dl.dropbox.com/u/1412774/FileReaderDemo/FileReaderDemo.capx

    The plugin : http://dl.dropbox.com/u/1412774/FileReaderDemo/pode_filereader.0.1.zip

    (And yes, I know there's a typo in my test file <img src="smileys/smiley2.gif" border="0" align="middle">)

  • Another great plugin from you.

  • This is neat, but could you make it have a 'load file' action that can use a path so files can be loaded via events dynamically? That would make it much, much more useful. Loading a level by choosing it in a window isn't really realistic.

  • Arima : it's not going to be possible in the current state of the support in the browsers, because it's breaking the sandbox model.

    The most I can do is allowing the styling of the button, to blend it in your webapp GUI.

    I'm going to search if there's a hack around it, but I'm pretty sure there isn't any, sorry.

  • Ah well. Thanks for the reply.

  • Arima: that's possible with ajax. I load json data at runtime - calling level1.php, level2.php.. ;)

  • Joe7 I was talking about loading from a file on a local disk, which as far as I understand AJAX is incapable of?

    BTW if you put a space between the and the person's name, it doesn't trigger an alert.

  • In fact, AJAX and FileReader can access a file directly on Chrome, if you set the flag to allow it. You can't obviously ask that to your user (because it's a big security risk).

  • I have updated the first post with a new build. You can now load image files too.

  • Nice plugin. Does it work with Awesomium though. I tried to export your test capx with the Awesomium exporter but when I press the Choose File button nothing happens. Tested this on r107 realease. Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Filhanteraren : since I have now way to debug it under the Awesomium export, I can't make the necessary changes...

  • Hello Pode, is possible to make a sprite as button instead of DOM which uses FileReader where you upload pictures?

    Because i developed some game with fullscreen for mobile, i tried to touch a FileReader button but the coordenates are wrong and won't respond

  • : the thing is it's up to each browser engine to decide how it's going to render a "FileReader". I'll try to see if I can force a something else than a DOM element <img src="smileys/smiley2.gif" border="0" align="middle" />.

  • Pode is there any way to add in support for csv files? I want to load a cvs file to parse with the csv plugin.

  • Pode

    I made the change on my copy of your plugin so it reads accordingly. Here is the change I made to the runtime starting on line 133. This allows me to load a csv file and hook into rex's csv plugin. Feel free to make the change :)

    if(this.file.name.endsWith("txt")

                                                                //|| f.name.endsWith("log")

                                                                || this.file.name.endsWith("xml")

                                                                || this.file.name.endsWith("svg")

                                                                || this.file.name.endsWith("csv")

                                                                //|| f.name.endsWith("tmx")      

                                                                || this.file.name.endsWith("html")      

                                                                || this.file.name.endsWith("htm")      )

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