[Plugin] FileReader

Forum Home Forum Home > Construct 2 Development > Plugins for Construct 2
 Post Reply Post Reply Page  12>
Author
5,295 Rep
Post Options Post Options   Quote Pode Quote  Post ReplyReply Direct Link To This Post Topic: [Plugin] FileReader
    Posted: 13 Mar 2012 at 2:29pm
Update v1.1 19/10/2012 : bugfixe + load images !
Here's a new version of the FileReader plugin !

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


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 ).

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).


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 )

Edited by Pode - 19 Oct 2012 at 5:02pm
Back to Top
1,103 Rep
Post Options Post Options   Quote ZaksCommunicates Quote  Post ReplyReply Direct Link To This Post Posted: 14 Mar 2012 at 10:35am
Another great plugin from you.
Back to Top

Moderator
11,940 Rep
Post Options Post Options   Quote Arima Quote  Post ReplyReply Direct Link To This Post Posted: 14 Mar 2012 at 9:07pm
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.

Edited by Arima - 14 Mar 2012 at 9:09pm
Back to Top
5,295 Rep
Post Options Post Options   Quote Pode Quote  Post ReplyReply Direct Link To This Post Posted: 14 Mar 2012 at 10:18pm
@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.
Back to Top

Moderator
11,940 Rep
Post Options Post Options   Quote Arima Quote  Post ReplyReply Direct Link To This Post Posted: 14 Mar 2012 at 11:00pm
Ah well. Thanks for the reply.
Back to Top
2,772 Rep
Post Options Post Options   Quote Joe7 Quote  Post ReplyReply Direct Link To This Post Posted: 15 Mar 2012 at 8:31am
@ Arima: that's possible with ajax. I load json data at runtime - calling level1.php, level2.php.. ;)


Edited by Joe7 - 15 Mar 2012 at 12:22pm
Back to Top

Moderator
11,940 Rep
Post Options Post Options   Quote Arima Quote  Post ReplyReply Direct Link To This Post Posted: 15 Mar 2012 at 6:44pm
@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.
Back to Top
5,295 Rep
Post Options Post Options   Quote Pode Quote  Post ReplyReply Direct Link To This Post Posted: 16 Mar 2012 at 7:09am
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).
Back to Top
5,295 Rep
Post Options Post Options   Quote Pode Quote  Post ReplyReply Direct Link To This Post Posted: 19 Oct 2012 at 10:45pm
I have updated the first post with a new build. You can now load image files too.
Back to Top
1,679 Rep
Post Options Post Options   Quote Filhanteraren Quote  Post ReplyReply Direct Link To This Post Posted: 22 Oct 2012 at 12:12am
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

Edited by Filhanteraren - 22 Oct 2012 at 12:58am
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down