[r200] Load image from URL or NWjs bug

Bugs will be moved here once resolved.

Post » Thu Apr 02, 2015 2:41 pm

Problem Description
This might be a bit difficult to explain, because it makes little sense. But it appears that when you use NWjs to open an image and load it into a sprite using "load image from url", but at the same time copy the file to a new destination and tell it to use that one instead. And then load a new image it still uses the old image despite it doesn't exist anymore. Guess it might read it from memory maybe?

Attach a Capx

Description of Capx
Allows you to select a jpg file and load it into a sprite. At the same time copying the file to "C:\Test.jpg" Right clicking the image will load the image from C:\Test.jpg.

Steps to Reproduce Bug
Will explain it with screenshots, otherwise it hard to explain and probably makes little sense I think.
The code of the whole program. The global variable was an attempt to see if it was possible to only load an image into a single sprite. Which seems to not work.

Double clicking one of sprites will open the NWjs dialog and I selected a image which is pure red.

The image is now copied to C:\Test.jpg.
1. To use this path I right click one of the sprites.
2. Double click one of the sprites and load the second image.

The second image is just green.

Looking at the image copied to C:\Test.jpg have been updated to use the green one instead.

Right clicking the sprites again to load from C:\Test.jpg makes them load the red image, even though the jpg file is the green one.

This only happens after you have used "Load image from url" (Right click the sprite).

The bug pretty much ruins the "load image from url" or NWjs open dialog depending on where the bug is. Would also be nice if you could pick which sprite it should load the image for, and not just all of them ignoring the picking.

Expected Result
That it would read the file from the path its told and not from maybe memory.

Affected Browsers
Don't know.

Operating System and Service Pack
Windows 7

Construct 2 Version ID
Posts: 1,175
Reputation: 6,744

Post » Mon Apr 13, 2015 10:43 am

'Load image from URL' is asynchronous: the action only starts it working, and it completes later when 'On image URL loaded' triggers. During the loading you synchronously copy and overwrite the file that is currently being loaded. This effectively makes it random which image you load, depending on which the system manages to do first: read the file, or copy the file over it.

Further reading and writing to C:\ normally requires admin permissions on most systems, which C2 games don't run with by default.

If you still think there is a problem, please file a new bug report that has a clearly ordered sequence of operations, and doesn't attempt to read or write files to/from system locations that normally require admin permissions to access.
Scirra Founder
Posts: 23,242
Reputation: 183,482

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 0 guests