Bug Report Problem with Browser and Javascript

Temporalin

New Member
Hi there, first time posting.
I've been working with StreamControl using HTML files to make some fancy layouts. It was working until I tried to automatically adjust an image. To do that I made this:
HTML:
mic = new createjs.Bitmap("images/mic.png");
micScaleX = 22 / mic.image.width;
micScaleY = 22 / mic.image.height;
mic.setTransform(x = 732, y = 720 - mic.image.height * micScaleY, scaleX = micScaleX, scaleY = micScaleY);

board.addChild(mic);

This works as intended in Firefox but not with the OBS Browser. I used alert(mic.image) to check if it was the same and both browsers return object HTMLImageElement. The difference appears when accessing attributes: alert(mic.image.width) returns the size in Firefox but 0 in OBS

What do I do? I know I could manually resize the image and avoid the need of accessing the attributes, but then this would remain unsolved and may be useful for other things or people

Thanks
 

Osiris

Active Member
What happens if you do alert(mic.image.naturalWidth)?

But if it doesn't work in Chrome, you should try to make it work in Chrome. If it works in Chrome it will work in the browser source.
 
Last edited:

Temporalin

New Member
I've been trying to fix it and it appears to be a problem loading images in EaselJS. The solution may be using PreloadJS.

As it seems it's a Chrome problem and not an OBS one, this thread could be closed. Thanks.
 
Top