Hai
?I need to set focus on the textbox, now i have used the code which i have given below, it is focusing on the textbox but i am not able to tye anything on the textbox only after the user clicks using mouse on the txtbox , after that oly i can type the txt on it.
?Without onclick of the txtbox, in onfocus itself i need to type the text in txtbox.
?
?I am using the setfocus in the login page for the username, but not able to type the txt.
?Login page is in flex, i used to call the swf directly while build. it is not passed through HTML
?can anyone help me.
Thanks In Advance
? private
userName.addEventListener(KeyboardEvent.KEY_DOWN, EnterKeyEvent);
password.addEventListener(KeyboardEvent.KEY_DOWN, EnterKeyEvent);
log.addEventListener (KeyboardEvent.KEY_DOWN , EnterKeyEvent);
userName.setFocus();
}
private function EnterKeyEvent (event:KeyboardEvent):void{
if(event.keyCode == 13){
login();
}
}
%26lt;mx:HTTPService
id=''logIn'' showBusyCursor=''true'' useProxy=''false'' url=''../LoginAction.do'' method=''POST'' result=''loginresultHandler(event)'' fault=''loginfaultHandler(event)''
%26gt;
%26lt;mx:request%26gt;
%26lt;userName%26gt;{userName.text}
%26lt;/userName%26gt;
%26lt;password%26gt;{password.text}
%26lt;/password%26gt;
%26lt;/mx:request%26gt;
%26lt;/mx:HTTPService%26gt;
How to set focus on a textboxThis is a common issue with Flash in Browsers. AFAIK there is only a solution for IE, not other browsers and it involves JavaScript call setFocus on the object tag on one of the document or window events. If you google you'll find it.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui
How to set focus on a textboxHai
?Thank you for your reply, but i am not able to get any from google, any other thing can u suggest
?Emergency pl
Thanks in Advance
Hi,
Pls find the solution of your problem, I have replied this question for someone else here.Pls let me know if you have any issue still.
http://forums.adobe.com/message/2132197#2132197
Hope this will fullfill your requirement.
with Regards,
Shardul Singh Bartwal
Hai Shardul Singh Bartwal
Thank u For your reply , but i am not using html, directly the swf oly i am using.
In build.xml i will mention where the swf should be placed after build, so it will be placed in that path, for login how to send swf from html
?Can u help me
Thanks In Advance
Hi,
Sorry to say I am not getting your problem.
But what I will suggest dont do any thing else,simply open the swf which you have been created after building your application i.e. under the
'bin-debug' or 'bin-release' folder.I think in that it will be already working fine but in builder during running or debugging you will not see it working.
Shardul Singh Bartwal
Hai?Shardul Singh Bartwal
?I implemented as u said, the cursor is blinking over that textbox and the focus is also there, but not able to type anyting
in that textbox....
FLEX CODE
private function getfocusLogin(event:Event):void{ userName.addEventListener(KeyboardEvent.KEY_DOWN, EnterKeyEvent); password.addEventListener(KeyboardEvent.KEY_DOWN, EnterKeyEvent); log.addEventListener (KeyboardEvent.KEY_DOWN , EnterKeyEvent); userName.setFocus(); }
mx:FormItem
label=''UserName'' color=''#F29E0C'' themeColor=''#EB8A0B'' fontFamily=''Verdana''
%26gt;
%26lt;mx:TextInput id=''userName'' x=''717'' y=''273'' width=''140'' color=''#050505'' name=''user'' creationComplete=''getfocusLogin(event)''
/%26gt;
%26lt;/mx:FormItem%26gt;
HTML CODE
%26lt;
html%26gt; %26lt;
head%26gt; %26lt;
title%26gt;GRC Project%26lt;/title%26gt;
%26lt;link rel=''shortcut icon'' href=''%26lt;%=request.getContextPath()%%26gt;/imgs/login/favicon.ico'' %26gt;
%26lt;script%26gt;
function
focusFlash(){
setFocus.focus();
lapFocus.focus();
}
functi
on fetchresolution(){
if ((screen.width %26lt; 800 ) %26amp;%26amp; (screen.height %26lt; 600)){
ale
rt(''Lowest height ''+ screen.width); ale
rt(''Lowest width''+ screen.height); }else
if ((screen.width %26lt;= 1024) %26amp;%26amp; (screen.height %26lt;= 768)){
obj = document.getElementBy
Id(''desktop''); obj.style.visibility
= 'visible'; }else
if ((screen.width %26lt;= 1280 ) %26amp;%26amp; (screen.height %26lt;= 800)){
obj = document.getElementBy
Id(''laptop''); obj.style.visibility
= 'visible';
}
}
%26lt;/script%26gt; %26lt;/
head%26gt; %26lt;
body bgcolor=''#FFFFFF'' body scroll=''no'' marginheight=0 topmargin=0 leftmargin=0 bottommargin=0 rightmargin=0 onLoad=''fetchresolution()''%26gt; %26lt;
div id=''desktop'' style=''position: absolute; visibility: hidden;''%26gt; %26lt;
OBJECT classid=''clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'' id=''setFocus'' codebase=''http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0, 40,0''
height
=''600'' width=''1020'' id=''Charting''%26gt;
%26lt;param name=movie value=''%26lt;%=request.getContextPath()%%26gt;/pages/flexreportlogin/flexreportlogin.swf''%26gt;
%26lt;param name=''quality'' value=''best'' /%26gt;
%26lt;param name=''scale'' value=''noscale'' /%26gt;
%26lt;param name=''salign'' value=''t'' /%26gt;
%26lt;param name=''wmode'' value=''opaque'' /%26gt;
%26lt;param name=''allowScriptAccess'' value=''sameDomain'' /%26gt;
%26lt;EMBED src=''%26lt;%=request.getContextPath()%%26gt;/pages/flexreportlogin/flexreportlogin.swf'' allowScriptAccess=''sameDomain'' quality=high NAME=''Charting'' ALIGN='''' TYPE=''application/x-shockwave-flash'' height=''600'' width=''1020''
PLUGINSPAGE=''http://www.macromedia.com/go/getflashplayer''%26gt;
%26lt;/EMBED%26gt; %26lt;/
OBJECT%26gt; %26lt;/
div%26gt;
%26lt;
div id=''laptop'' style=''position: absolute; visibility: hidden;''%26gt; %26lt;
OBJECT classid=''clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'' id=''lapFocus'' codebase=''http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0, 40,0''
width
=''1275'' HEIGHT=''650'' id=''lapchart''%26gt;
%26lt;param name=movie value=''%26lt;%=request.getContextPath()%%26gt;/pages/flexreportlogin/flexreportlogin.swf''%26gt;
%26lt;param name=''quality'' value=''best'' /%26gt;
%26lt;param name=''scale'' value=''noscale'' /%26gt;
%26lt;param name=''salign'' value=''t'' /%26gt;
%26lt;param name=''wmode'' value=''opaque'' /%26gt;
%26lt;param name=''allowScriptAccess'' value=''sameDomain'' /%26gt;
%26lt;EMBED src=''%26lt;%=request.getContextPath()%%26gt;/pages/flexreportlogin/flexreportlogin.swf'' allowScriptAccess=''sameDomain'' quality=high NAME=''lapchart'' ALIGN='''' TYPE=''application/x-shockwave-flash'' width=''1275'' HEIGHT=''650''
PLUGINSPAGE=''http://www.macromedia.com/go/getflashplayer''%26gt;
%26lt;/EMBED%26gt; %26lt;/
OBJECT%26gt; %26lt;/
div%26gt;
%26lt;/
body%26gt; %26lt;/
html%26gt;
?
Hai Shardul Singh Bartwal
Thank u For your reply , It is working fine, it is correct answer, thank u very much....
No comments:
Post a Comment