Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Flash to XHTML focus

Flash has focus, how to give an XHTML element focus when pressing tab?

9:25 pm on Apr 14, 2011 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member jab_creations is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 26, 2004
posts: 3145
votes: 12

I have an object in Flash named 'widget1' and I'd like to give an XHTML element focus when the user presses the tab key while 'widgit1' has focus...so pressing the tab key would trigger widgit1's onblur event.

I've tried adding an event listener like so...

widgit1.addEventListener('keypress', ohhai);

function ohhai()
getURL("javascript:alert('oh hai!')");

However no matter what I do (and I'm 100% as I've got cache disabled in my browser and I re-public after every change) nothing happens. I've tried adding the event listener on the object directly, on different frames (first and last)...not really sure though once I get a JavaScript alert from pressing a key while widgit1 has focus I should be good. Is this something I'd have to associate with an onload event in example? Thoughts please?

- John