Closed
Bug 1306487
Opened 9 years ago
Closed 9 years ago
Loading images in Javascript File from Image.src fails
Categories
(Webmaker Graveyard :: Thimble, defect)
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: jadendreamer13, Unassigned)
Details
Attachments
(4 files, 1 obsolete file)
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•9 years ago
|
OS: Unspecified → Windows 10
| Reporter | ||
Updated•9 years ago
|
Hardware: Unspecified → x86_64
| Reporter | ||
Comment 1•9 years ago
|
||
| Reporter | ||
Comment 2•9 years ago
|
||
| Reporter | ||
Comment 3•9 years ago
|
||
Attachment #8796334 -
Attachment is obsolete: true
| Reporter | ||
Comment 4•9 years ago
|
||
Comment 5•9 years ago
|
||
Closing this bug as part of the deprecation of the Webmaker product on Bugzilla.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•