New File Chooser - No Simulate Touch?

Discussion and feedback on Construct 2

Post » Thu Jun 26, 2014 12:06 am

Hello

The new file chooser is a great addition to C2, however I find it annoying that you have to have the big ugly DOM element on your app, why not include a way to allow a sprite or other object to be used to simulate touching of the DOM element and have the DOM element hidden off of the screen @Ashley


But besides that, I like what I am seeing! :D
B
18
S
6
Posts: 348
Reputation: 2,633

Post » Thu Jun 26, 2014 12:40 am

You can't trigger a click event on a file input due to some implementation b.s but if you're exporting to node-webkit it's possible. Give the filechooser an id ('i.e file_chooser) in the properties bar and add the browser object to your project

On some event
Browser Execute javascript "file_chooser.click()"
B
11
S
2
G
1
Posts: 202
Reputation: 1,580

Post » Thu Jun 26, 2014 1:44 am

Noncentz705 wrote:You can't trigger a click event on a file input due to some implementation b.s but if you're exporting to node-webkit it's possible. Give the filechooser an id ('i.e file_chooser) in the properties bar and add the browser object to your project

On some event
Browser Execute javascript "file_chooser.click()"


It is most definitely possible. But its sort of a a work-around. It has been done on this third party File Reader. https://www.scirra.com/forum/viewtopic.php?f=153&t=67997&p=794805&hilit=file+reader#p794805


EDIT: However, the Browser execute Javascript works giving the file reader an ID.
B
18
S
6
Posts: 348
Reputation: 2,633

Post » Thu Jun 26, 2014 3:03 am

Sorry you're right but there was a time where you couldn't.
It seems most browsers have updated to allow it. It still may be blocked as a popup though, at least that's the case with Firefox.
B
11
S
2
G
1
Posts: 202
Reputation: 1,580

Post » Thu Jun 26, 2014 11:10 am

Some browsers like Safari on iOS show a popup next to the element when you press it. Wouldn't moving it offscreen break that?
Scirra Founder
B
402
S
238
G
89
Posts: 24,637
Reputation: 196,071

Post » Thu Jun 26, 2014 11:15 am

@Ashley I haven't tried iOS with giving a Javascript execute to a sprite and moving the element off-screen. I tried it in Chrome, Chrome on Android, Firefox and Crosswalk and all of these work. However I am unsure of iOS. If it is the case like you state that it would break what would be your solution?
B
18
S
6
Posts: 348
Reputation: 2,633

Post » Thu Jun 26, 2014 11:17 am

@GameThirsty - my solution would be to leave it as it is!
Scirra Founder
B
402
S
238
G
89
Posts: 24,637
Reputation: 196,071

Post » Thu Jun 26, 2014 11:27 am

@GameThirsty if it's just the appearance of input that bugs you, maybe give it an opacity of zero with css and place a sprite on top of it.
B
11
S
2
G
1
Posts: 202
Reputation: 1,580

Post » Thu Jun 26, 2014 1:27 pm

Thanks both of you. I should be able to do that.

One more question @Ashley before I quit bugging you. Using the file chooser and inside its properties bar where you can state what files to filter. Can you filter multiple file types in that?

I'm not trying to be a pain. Thank you!
B
18
S
6
Posts: 348
Reputation: 2,633

Post » Thu Jun 26, 2014 1:40 pm

Yes, just comma separate them.
Scirra Founder
B
402
S
238
G
89
Posts: 24,637
Reputation: 196,071


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 4 guests