How do I use file Chooser

Just started using Construct 2? Post your questions here

Post » Sat Jun 28, 2014 9:57 am

Hello,

I didn't quite understand the usage of file chooser. I added the plugin. I want to make a sprite load the chosen image file if it is it is an image, set textbox of a txt file if the chosen thing is a text file and display the url in a text. How do i do that?

Thanks,
Ashwin
B
15
S
3
G
1
Posts: 111
Reputation: 1,664

Post » Sat Jun 28, 2014 10:41 am

Ashwin try this demo
You do not have the required permissions to view the files attached to this post.
B
250
S
39
G
15
Posts: 1,953
Reputation: 40,623

Post » Sat Jun 28, 2014 11:13 am

not this one, the one scirra has provided in the latest version
B
15
S
3
G
1
Posts: 111
Reputation: 1,664

Post » Sat Jun 28, 2014 12:14 pm

After choosing a file, the file chooser plugin gives you a URL to the file (the FileURL expression). You can pass that to the Sprite's 'Load image from URL' action or make an AJAX request to it.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Post » Sat Jun 28, 2014 2:03 pm

Here's a silly example based on what Ashley as said. Use the Filechooser to select an image, then try a text file. Hopefully all self-explanatory.
You do not have the required permissions to view the files attached to this post.
Last edited by zenox98 on Tue Jul 01, 2014 6:16 pm, edited 1 time in total.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,386
Reputation: 58,454

Post » Sun Jun 29, 2014 10:42 am

I tried to replicate your demo @zenox98 but couldn't quite get it right. now when i add File chooser- on change --> Set textbox.text to Filechooser.FileType (Index). What should i add in the place of 'index'?
B
15
S
3
G
1
Posts: 111
Reputation: 1,664

Post » Sun Jun 29, 2014 10:45 am

For index, I used the number zero, based on the premise that, like arrays, it will be zero-based.

** Edit **

Just checked, and you if set Filechooser 'Select' property to 'Multiple', then choose more than one image, setting index to 1 does indeed select the second file.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,386
Reputation: 58,454

Post » Thu Jul 03, 2014 3:39 am

Any idea why does the "file chooser" button always appears on top of all layers? How to get around with that?
For game development / IT services contact - [email protected]

List of published iOS apps -
https://itunes.apple.com/us/artist/ravi ... d693234511
B
84
S
20
G
3
Posts: 337
Reputation: 7,368

Post » Thu Jul 03, 2014 11:22 am

even text boxes always come on top of the layer. @ashley - any help ?
B
15
S
3
G
1
Posts: 111
Reputation: 1,664

Post » Thu Jul 03, 2014 12:04 pm

All form controls float above the canvas. That can't be changed.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: FartsLolz and 1 guest