Skip to main content
Inspiring
February 21, 2023
Question

How to make HTML5 game accessible to users

  • February 21, 2023
  • 3 replies
  • 2190 views

Hi. I've tried to recreate a simple AS3 game with the HTML5 canvas, using Javascript. This is the first time I've done this and it's for pupils and staff to use at our school.

It all works fine when I test it from Animate - it opens in a browser and plays. But when I publish it and I get HTML, JS and FLA files, clicking on the HTML file just brings up the visuals, but it isn't interactive in any way. I've tried using the 'Include Javascript in HTML' option, but that didn't make any difference.

Our school has a website, but it doesn't allow for installing game files. Is there a way for people in the school to access and play it locally, maybe from the server - or even from individual PCs' C drives?

The reason I don't want to use AS3 is because the pupils mainly use iPads now.

Thanks.

This topic has been closed for replies.

3 replies

Inspiring
March 1, 2023

Hi. I've sorted it, thanks. I'd set the site up incorrectly on IIS. Thank you all for your help.

kglad
Adobe Expert
March 1, 2023

@pauls73381349 

 

you're welcome.

Colin Holgate
Inspiring
February 21, 2023

The include JavaScript would have helped with some sescurity issues. The other thing you can do is uncheck any spritesheet options, let it create individual images. That would then test locally ok, and you could publish again using spritesheets for the server based version, to help the page load quicker.

I didn't yet figure out a way for my iPad to open local HTML files.

kglad
Adobe Expert
February 21, 2023

they should be able to use the html, js and source folder(s), from any web server, but not locally

Inspiring
February 23, 2023

Thanks for the reply. I've now discovered IIS on our server and I've put the html and js files, plus the images and sounds folders in the root directory. I can now see the game and interact with some of it but not all - and there's no sound. Am I missing something?

Inspiring
February 27, 2023

which line is 1370 in the code you showed and where is playPiano declared?


My apologies - I hadn't realised that 1370 referred to a line of code in the js file. I knew I hadn't written that much code and I'm used to AS3 where the only code is what I've written.

Here's the code around that line:

function activatePiano() {
			
	if(!pianoActive){
		
		pianoActive = true
		root.piano_btn.gotoAndStop(4)
		root.piano_mc.alpha = 1
		playPiano.muted = false
		if(soundPlaying){
			root.piano_mc.play()
		}
		
	} else {
		
(ln 1370)	pianoActive = false
		root.piano_btn.gotoAndStop(0)
		root.piano_mc.gotoAndStop(0)
		root.piano_mc.alpha = 0.5
		playPiano.muted = true
		
	}

The sound file should be playing already, but muted, and piano_mc should be faded out a bit. When piano_btn is clicked, piano_btn gets a red line around it (frame 4), piano_mc gets full alpha and starts a looped animation and the piano audio is unmuted.

When it's clicked again, piano_mc's animation stops at frame 0 and is faded out, the red line around the button disappears (frame 0) and the sound is muted.