Drag and drop images into Construct ?

For questions about using Classic.

Post » Tue Aug 02, 2011 10:11 pm

Can you drag and drop files(.png images) into a Construct game or app while its running ?
B
19
S
6
G
7
Posts: 1,204
Reputation: 7,296

Post » Tue Aug 02, 2011 10:23 pm

You'll have to use python to achieve that. Here is a topic with an example:
http://www.scirra.com/forum/drag-and-drop-files-from-windows-explorer_topic41792_post257752.html#257752R0J0hound2011-08-02 22:23:49
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Wed Aug 03, 2011 11:59 am

Thanks
B
19
S
6
G
7
Posts: 1,204
Reputation: 7,296

Post » Tue Aug 09, 2011 1:23 pm

Using your python example, i can drag a picture file into the window and use the image manipulator to load the image, but the the Frame rate drops to about 20 if i dont include an event to stop the 'Loop'.

+ picture: picture overlaps frame
-> Wait: Delay 100 ms
-> ImageManipulator: Load image Text.Text
-> Wait: Delay 100 ms
-> ImageManipulator: Resize to 128 x 128
-> Wait: Delay 100 ms
-> ImageManipulator: Copy image to sprite picture
-> Wait: Delay 100 ms
-> frame: Destroy ( I HAVE TO INCLUDE AN EVENT TO STOP THE 'LOOP')

I can get it to work if i drag the image into the window, drop it and then drag it again.
Hope this makes sense?


I have included the cap Here
B
19
S
6
G
7
Posts: 1,204
Reputation: 7,296

Post » Sun Aug 14, 2011 1:08 am

I wondered if anybody could look at the above problem ? (posted 9/Aug)

Could really do with a solution.

Thanks in advance
B
19
S
6
G
7
Posts: 1,204
Reputation: 7,296

Post » Sun Aug 14, 2011 8:35 pm

You want to be able to drag the images only on the frame object, right?

This should do it:
+ Text: [negated] Text is "" (case: No)
   + System: frame at (MouseX,MouseY)
   -> ImageManipulator: Load image Text.Text
   -> ImageManipulator: Resize to 128 x 128
   -> ImageManipulator: Copy image to sprite picture
   + System: Always (every tick)
   -> Text: Set text to ""

I haven't found a way to get the file location before the file is dropped, so you can't have the image previewing before the drop.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Sun Aug 14, 2011 11:45 pm

[QUOTE=R0J0hound] You want to be able to drag the images only on the frame object, right?

This should do it:
+ Text: [negated] Text is "" (case: No)
   + System: frame at (MouseX,MouseY)
   -> ImageManipulator: Load image Text.Text
   -> ImageManipulator: Resize to 128 x 128
   -> ImageManipulator: Copy image to sprite picture
   + System: Always (every tick)
   -> Text: Set text to ""

I haven't found a way to get the file location before the file is dropped, so you can't have the image previewing before the drop.[/QUOTE]
---------------------------------------------------------

Thanks for the reply

"You want to be able to drag the images only on the frame object, right?"

No........The frame object doesnt need to be there. I just added it just to help me solve my problem?

Basically i want to do the following :

1, Run the app
2, Drag a image file into the app window.
3, On drop, the image manipulator loads and displays the image.

I created the following events:

+ picture: picture overlaps frame
-> Wait: Delay 100 ms
-> ImageManipulator: Load image Text.Text
-> Wait: Delay 100 ms
-> ImageManipulator: Resize to 128 x 128
-> Wait: Delay 100 ms
-> ImageManipulator: Copy image to sprite picture

ON DROP..... the image loads OK...........................BUT THE FRAMERATE DROPS (AND STAYS) AT 20 FPS.

Adding " -> frame: Destroy " as a FINAL EVENT stops the Framerate drop (it must stop a loop ?)

Am i making sense ?
--------------------------------------------------------

"I haven't found a way to get the file location before the file is dropped, so you can't have the image previewing before the drop"

This part not a problem.
B
19
S
6
G
7
Posts: 1,204
Reputation: 7,296

Post » Mon Aug 15, 2011 1:04 am

Ok gotcha,
The framerate is dropping because the image is being loaded continually. Adding a "trigger once" to your condition will fix it so that the image is loaded only once every time picture overlaps frame. You could also just use "on collision" instead of "is overlapping". Also the wait actions are not necessary it will work fine without them.R0J0hound2011-08-15 01:04:54
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Mon Aug 15, 2011 5:52 pm

[QUOTE=R0J0hound] Ok gotcha,
The framerate is dropping because the image is being loaded continually. Adding a "trigger once" to your condition will fix it so that the image is loaded only once every time picture overlaps frame. You could also just use "on collision" instead of "is overlapping". Also the wait actions are not necessary it will work fine without them.[/QUOTE]

-------------------------------

Already tried all the above before i intoduced the frame?

It wont load the first image(takes about 3 tries)
B
19
S
6
G
7
Posts: 1,204
Reputation: 7,296


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest