I am using Stencyl and am trying to get the html5 export to work. However, even if I build a blank project, on firefox, when I test the html5 bulid I always get this error:
IndexSizeError: Index or size is negative or greater than the allowed amount
It points to this line of the generated javascript file.
Anyone got any ideas of what the problem could be?
In a Stencyl install, can you find where the OpenFL files are?
I believe this is occuring within the “CanvasShape” class, located under “openfl/_internal/renderer/canvas/CanvasShape.hx”
Perhaps you could add something like this around line 52:
trace (scrollRect);
trace (graphics.__bounds);
It would be helpful to know the size of both of these values, and to know what they were before it hit this problem. We need to ignore a render call that will have a width or height of <= 0. I wonder if the __graphics.bounds are empty, or if it is a scrollRect that is too small
I managed to work out this was to do with Stencyl’s preloader which will draw the percentage loaded with a rectangle and if 0% is loaded then it will attempt to draw a rectangle with width 0.
Hmm… Not sure what’s this issue here, but now all rectangles appear black (so black backgrounds and a black loading bar) when I updated. It works fine on flash and was fine for colour using openfl 3.3.1 from 08/22/15. Is there anything that you can think of that could’ve messed this up (and something I need to change on my end)
Hmm, strange. The preloader is working here for me, so I would need to know more/have more in order to reproduce exactly what you’re seeing. Is there some way I can test Stencyl with HTML5 support?
Okay, I had another look at this, because I was confused, and it turned out that I managed to break it when trying to fix the initial issue. However, it also turns out that your fix didn’t work - my attempt at fixing it allowed it to build.
However, now I managed to fix it by modifying around line 52 of the CanvasShape class to read:
[code] if (graphics.__bounds.width > 0 && graphics.__bounds.height > 0){
if (scrollRect == null) {
You seem to refer to scrollRect before you initiate it which pulls up an error for me, and I also get this error:
[neko] C:/Program Files (x86)/Stencyl/plaf/haxe/lib/openfl/openfl/openfl/display/DisplayObject.hx:172: lines 172-1875 : Defined in this class
[neko] C:/Program Files (x86)/Stencyl/plaf/haxe/lib/openfl/openfl/openfl/_internal/renderer/canvas/CanvasShape.hx:38: characters 71-77 : Cannot inline a not final return
Sorry to do a little bit of thread necromancy, but I spent about an hour searching online for the exact thread title and this is what came up on the top of google. Another hour of headbanging and I found a solution that may help other people searching here.
My code worked on first compile in Firefox, and nothing after that. Everything seemed to work great in every other target including Flash and Chrome. I opened up the java console and noticed a non-error non-warning that’s hidden by default along side some other erroneous errors that confused the hell out of me.
GET http://localhost:2000/ [HTTP/1.1 304 Not Modified 1ms]
That “Not Modified” part.
So even though the code was being updated and recompiled, Firefox didn’t care. Hitting refresh gave the same series of messages for each file. I had to do the hard refresh (hold shift when clicking the refresh button) to force it to reload everything and VOILA! Firefox ran the program fine.
So, to test in Firefox I need to shift click refresh every single time I open a new version or it breaks.