[quote=145119:@Stefano Basile]Dim Start As Integer
Dim Left As Integer
For Start=0 to 20
g.DrawPicture(ListImage(Start),Left,10)
Left=Left+10
Next[/quote]
If what you want to do is a picture that changes and moves, you cannot do that in one pass within the event. Unlike Desktop, Web Edition UI does not update until the event is over, so the For Next animation will not show.
If you want to do that, you need to place the canvas left change in a timer and call Canvas.Invalidate to update the picture.
The reason why the picture does not show is that when the event finishes, Left is 200. If your canvas is 150, it makes sense.
Change the array to type WebPicture and make sure the array exists outside of the paint event. I suspect the problem you are running into is that the images are going out of scope before (or not available) when the canvas draws.
Just so you understand this better… An HTML5 canvas requires that the picture exist in the browser’s cache before it can be drawn on the page. What that means is that we can’t acually draw the image in the first event loop after you call the command. What we have to do first is make the browser request each of the images. Each time a the browser downloads an image, we call the Invalidate method so that sometime “soon” the canvas will be refreshed and the canvas will draw. Here’s the trick though… that array of Pictures or WebPictures must not change between paint events. They must persist long enough for the browser to download the image at least once, or the browser will get an error and the image just won’t be displayed.
Anyway, I suspect that the times it works is just happenstance that the browser is able to retrieve the image before it goes away.
If you are still having trouble, create a Feedback inquiry case and attach this sample to it and I’ll take a look at your code.
Leaving a feedback on xojo tell me that is not a bug because I made a code too heavy, uploading images into an array. I have made a very simple example uploading pictures by the project itself, but the g.drawpicture not work.