A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Keyboard controls dont work in published HTML+SWF game

  1. #1
    Senior Member
    Join Date
    Jun 2001
    I have a skiing game for my companies website. I have tested it extensivly in Flash and it works great. Now that I am ready to publish the final product--which MUST be played in an HTML window over the web, I have published the files and went to test it. 2 MAJOR baffling problems.
    1. The file doesn't even show up in IE window if I open the HTML file in IE. I think that it just can't find the reference to the SWF file, but if you know I am wrong and have seen this problem please let me know.
    2. I open the file in Netscape 4.5 and the spacebar control works, BUT the arrow keys to control movement DON'T and the collision tests also don't work.

    These tests are on a Mac, I haven't even tried the PC yet. And please don't reply bashing Macs--if I had my choice I would be doing this on a PC, but this is what I have at work.

    Thanks for any help you can give me.

  2. #2
    Elvis...who tha f**k is Elvis? phreax's Avatar
    Join Date
    Feb 2001
    I have encountered the problem with the arrow keys not working, and I solved that by making the HTML page manually instead of the published version by Flash!

    If you have Dreamweaver you can just import it as a swf, but otherwise take a loo at the HTML page created by flash and copy the data to a "clean" document!

  3. #3


    first, check to see if all the functions r working correctly..here's the code for moving up, down, etc.
    onClipEvent (load) {
    s = 5;
    onClipEvent (enterFrame) {
    if(Key.isDown(Key.UP)) {
    _y -= s;
    if(Key.isDown(Key.DOWN)) {
    _y += s;
    if(Key.isDown(Key.LEFT)) {
    _x -= s;
    if(Key.isDown(Key.RIGHT)) {
    _x += s;

    ok this should work as your basic controls...
    the 5 next to the s in the load contents, you cn change it to make it go faster or slower.

    If your code still dont work, publish it and try clicking on the screen before doing anything...
    hope it helps...

  4. #4
    Agent de Folie dJide's Avatar
    Join Date
    Jan 2002
    If the arrows dont even work in normal SWF mode, then you should check that the arrow key detections are all good, as shiz said. If it's just a browser problem try what phreax did and make sure your Flash Player works.

  5. #5
    Elvis...who tha f**k is Elvis? phreax's Avatar
    Join Date
    Feb 2001
    Yeah, what I encountered was only when I was using the HTML that Flash generated when publishing! It worked perfectly through the .swf! Very strange!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center