Jump to content

HTML5 Question - help needed.


agarza

Recommended Posts

Hello,

 

I've been playing lately about with the new canvas features of html5.

I did a method that draws a little 5 by 5 map in a canvas by inserting 25 images.

The only problem is that when I call it manually it doesn't add the images; however, if I use <body onLoad="fucntion();"> it works.

I realized that the script does run (when i call the method manually), but when it runs this line

ctx.drawImage(mapTilesImage, (mapTiles[index][3]*32), (mapTiles[index][2]*32), 32, 32, xCount, yCount, 32, 32);

the image is not drawn in the canvas. Also, if I make it send an alert() just before it runs that line it seems to draw the image after i close the alert window.

 

I tried figuring it out, but I couldn't so I decided to ask.

If you need the code let me know..

 

thanks in advance..

Link to comment
https://forums.phpfreaks.com/topic/198183-html5-question-help-needed/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.