Flash Focus in HTML page?


I found a post about detecting focus for an HTML page containing a flash movie. I have a problem with buttons in an MP3 player not working correctly when changeing HTML pages. However, when I test this code…

<BODY onFocus=“alert(‘you have focus’);” onBlur=“alert(‘blur’);”>
test focus

If I select the page, it traces I have focus. If I select the player that is embedded in the HTML page, it traces blur. I am not sure this is my issue with the buttons not responding correctly when changing pages as it also seems to be from the initial load. The play button must be selected, then stopped, then selected again. After that, everything works until you change page focus and return to the player.If I load the player by itself, it works fine. Although, I need the HTML page to allow users to load their own MP3’s into the player. Here is a demo of the player embedded in an HTML page…


Is focus one of my issues here?

I also seem to have an issue with my random play function. It works when testing in author mode, but doesn’t work with either the .swf or the .swf embedded in an HTML page. Here is what I have for the random play function…

_root.onLoad = function() {        
randomPlay = function () {
		list = _root.lBox.labels.length;
		myRandomSong = _root.lBox.getSelectedItem().label;
		myRandomArtist = _root.lBox.getSelectedItem().data;
		_root.status.text = "Playing";
		_root.artist.text = myRandomArtist;
		_root.song.text = myRandomSong;

Anyone have any ideas of what I have done wrong?

Thanks in advance

is it blurring as soon as you click within the flash file?
if so its because youve got your tracers on the <body> tag and you will need it on your swf <embed> tags



Yes, putting the trace in the embed seems to work for selecting focus on the player and blur on the HTML page that contains the player. I still can’t figure out why the buttons do not initially work. When I test it in authormode, everything works correctly. When I test the swf by itself or in an HTML page, the initial button release code does not fire until you have pressed the play button, then press the stop button, then the everything works fine again. Why would the button functions work correctly in authormode, but not in the swf or embedded in an HTML page?

Thanks for replying