A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: help! Arrow keys scrolling page!

  1. #1
    Member
    Join Date
    Dec 2006
    Posts
    42

    help! Arrow keys scrolling page!

    I made a game which when I goto play it, pressing the arrow keys (control character) scrolls the browser window up and down. I thought about setting movement to letter keys, but not sure how to do that either.

    I heard there might be a way to change a setting in publish to override the arrow keys control of the browser window? if not...what would be the correct script to asign letters to movement, rather than arrows.

  2. #2
    Getting There! bitsk308's Avatar
    Join Date
    Jul 2000
    Location
    Phoenix, AZ
    Posts
    427
    Once the flash piece has focus within the browser, the arrow keys will effect it, not the browser. Click on it to give it focus or find a javascript to give it default focus.

    _b

  3. #3
    Member
    Join Date
    Dec 2006
    Posts
    42
    focus - you mean click on? (active area)
    the game is being dumped into a div layer on someone else's page. How would I add JS???

  4. #4
    Getting There! bitsk308's Avatar
    Join Date
    Jul 2000
    Location
    Phoenix, AZ
    Posts
    427
    if you're not in control of the html page, then you don't ad JS. I would recomend adding a button to lure the user into clicking the flash piece, maybe a 'Start Game' button or something.

  5. #5
    Member
    Join Date
    Dec 2006
    Posts
    42
    from what I've gathered theres something in the page's code, or the shell whcih my flash is set into which is bugging out your solution.

    I don't want to re script all the controls, and thought there might be an actual setting in publish which could solve my problem ;(

  6. #6
    Getting There! bitsk308's Avatar
    Join Date
    Jul 2000
    Location
    Phoenix, AZ
    Posts
    427
    My solution isn't some tricky thing that can be bugged i didn't think. The browser will pass the keyboard input to what ever element has focus. If its a drop down menu, the arrow keys will cycle through the options, if it's a text field, it will move the cursor up and down a line, if its a flash piece AND that flash piece has key listeners properly set, it will do what ever those listeners dictate. I've never experienced any other page code that can override that browser behavior. Of course that's not to say it isn't possible. I assume everything works fine when you publish in flash player? Are you loading this flash game into another .swf?

    It might help if I could see what you were talking about. Is there a link you could share?

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