Loading images in Javascript File from Image.src fails

RESOLVED INCOMPLETE

Status

Webmaker
Thimble
RESOLVED INCOMPLETE
a year ago
8 months ago

People

(Reporter: jadendreamer13, Unassigned)

Tracking

Details

Attachments

(4 attachments, 1 obsolete attachment)

(Reporter)

Description

a year ago
Created attachment 8796334 [details]
thimble.png

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36

Steps to reproduce:

In the project I uploaded sprites.png and I also created a javascript file. Both are in the root directory. When I reference it as an image in html like <img src=sprites.png /> it works just fine. As soon as I try to load it in a javascript file it says the image cannot be found.

//Load a sprite sheet and map sprites to it
var SpriteSheet = new function() {
  this.map = { }; 

  this.load = function(spriteData,callback) { 
    this.map = spriteData;
    this.image = new Image();
    this.image.onload = callback;
    this.image.src = 'sprites.png'; //this says file is not found
  };
}


Actual results:

File not found when it does everywhere else, it seems like the js file isn't using the correct relative path to the image's location. I tried seeing if it was loaded in the application resources and it appears to be but it's not in the same path as the root directory displayed in my 


Expected results:

It should have loaded the image from sprites.png located in the root file directory. In the screenshots I'm sending I have the JS files nested in a js folder but this is also happening when they're in the root folder.
(Reporter)

Updated

a year ago
OS: Unspecified → Windows 10
(Reporter)

Updated

a year ago
Hardware: Unspecified → x86_64
(Reporter)

Comment 1

a year ago
Created attachment 8796335 [details]
Screenshot (2).png
(Reporter)

Comment 2

a year ago
Created attachment 8796336 [details]
Screenshot (3).png
(Reporter)

Comment 3

a year ago
Created attachment 8796337 [details]
Screenshot (4).png
Attachment #8796334 - Attachment is obsolete: true
(Reporter)

Comment 4

a year ago
Created attachment 8796338 [details]
Screenshot (5).png
Closing this bug as part of the deprecation of the Webmaker product on Bugzilla.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.