View Full Version : Selection.setFocus
mooler
May 7th, 2003, 09:33 AM
Hi when using Selection.setFocus in my main timeline it won´t work. The curser goes to the selected textfield but it won´t accept any typing until I click it with the mouse.
In another forum I read tha I have to set the focus to Flash to get the setFocus action to work.
That one flew right over my head ;-) does anybody have any similar experience and how did you solve it?
brainy
May 7th, 2003, 11:38 AM
well, the textfield has focus inside the flash movie, but the flash movie doesnt have focus inside the HTML document... to solve this you need to set focus to the movie when the page loads. so, add something like this to a script tag in the head:
function focusFlash() {
myFlashMovie.focus();
}
and add an onLoad event to your body, like this:
onLoad="focusFlash()"
oh, replace ‘myFlashMovie’ with your movie's name.
*edit* errr, cant post html code in a code tag?
mooler
May 7th, 2003, 12:18 PM
GREAT!!!
THX
Very helpful :)
mooler
May 7th, 2003, 01:07 PM
Hmm I tried it and tried it again and search for answers but sorry to bug you again can´t find the answer (-:
Using this code in my html page can anyone see what´s wrong with it...
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript">
function focusFlash() {
setFocus.swf.focus();
}
</script>
</head>
<body onLoad="focusFlash()">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="400">
<param name="movie" value="setFocus.swf">
<param name="quality" value="high">
<embed src="setFocus.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="400"></embed></object>
</body>
</html>
shuga
May 7th, 2003, 03:40 PM
i'm having the same problem.
how do i make the script work
here's how my script looks in the HTML
<SCRIPT LANGUAGE="java script">
function focusFlash() {
peoplesearch.swf.focus();
}
</script>
brainy
May 8th, 2003, 03:47 AM
drop the '.swf' :)
setFocus.focus(); would work.
and so would peoplesearch.focus();
mooler
May 8th, 2003, 10:18 AM
**** I must be missing something I can´t get it to work.
Attaching file and hoping someone has the time to check them for error :hangover:
brainy
May 8th, 2003, 11:14 AM
ah, you need the 'name' attribute in the <object> and <embed> tags... add this:
name = "setFocus"
i assumed you were using flash's generated tags which add that automatically.
shuga
May 8th, 2003, 02:06 PM
still doesn't work :(
<HTML>
<HEAD>
<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
<TITLE>peoplesearch</TITLE>
<SCRIPT LANGUAGE="java script">
function focusFlash() {
peoplesearch.focus();
}
</script>
</HEAD>
<BODY bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="focusFlash()">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="490" height="120" name = "setFocus">
<param name=movie value="peoplesearch.swf">
<param name=quality value=high>
<embed src="peoplesearch.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="490" height="120" name = "setFocus">
</embed>
</object>
</BODY>
</HTML>
i am sofa king we todd did
mooler
May 8th, 2003, 02:15 PM
Unfortunatly same here :cyclops:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="java script">
function focusFlash() {
setFocus.focus();
}
</script>
</head>
<body onLoad="focusFlash()">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="400" name = "setFocus">
<param name="movie" value="setFocus.swf">
<param name="quality" value="high">
<embed src="setFocus.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" name = "setFocus" type="application/x-shockwave-flash" width="550" height="400"></embed></object>
</body>
</html>
brainy
May 9th, 2003, 08:37 AM
ok, lemme explain it a little further.... what appears as the "name" of the flash movie object, should appear in the script before the ".focus()" method. shuga, if your script refers to 'peoplesearch' your movie's name should also be 'peoplesearch'.
and i think that script doesnt work for you mooler because "java script" is not a valid language! its "JavaScript", no space..
mooler
May 9th, 2003, 08:47 AM
Stupid me :)
Now it works just great thx a million for your patiance brainy!!!
brainy
May 9th, 2003, 10:47 AM
haha, any time :D
shuga
May 9th, 2003, 12:30 PM
i'm off work today so i won't be able to see if it works till monday. the name of my movie is peoplesearch.swf and aside from that i don't see anything wrong with my code. but i guess i'll check on monday ... thanks for the help
additionally i tried setting the tabIndex in flash but that didn't help to do anything but make it so my other buttons didn't respond to tabbing
i guess when you set a tab index you have to then specify all buttons in the movie in their order of importance
mooler
May 15th, 2003, 01:54 PM
Hi again brainy hope you can help me with this one as well.
The focus works great but after filling in that textfield and using Tab the curser jumps to the url textfield of the browser insted of the next textfield in flash.
This code is in the same frame as the textfields (it´s a form)
name_txt.tabIndex = 1;
email_txt.tabIndex = 2;
adress_txt.tabIndex = 3;
comments_txt.tabIndex = 4;
send_btn.tabIndex = 5;
Selection.setFocus(name_txt);
Do you see any errors?
As before it works fine as a stand alone movie but in the browser it does not?
THX
brainy
May 15th, 2003, 02:32 PM
hmm. i guess this is cause explorer is catching the TAB click and not sending it to the flash movie... im not sure there's a way to get that to work...
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.