SetFocus on a textField
Hi how do I set focus on a textfield after i validate the data. If the validation fails, I want to setFocus on the text field that failed validation. Is there a way I can do this.
Dear nbruckelmyer
If your get getMsgBox(); calls a frame or a non modal dialog then u will have to use
public void getMsgBox() {
.. display the box.
//after ok button pressed.
dispose();
//then requestfocus
lengthTextField.requestFocus();
}Why? . Because after calling the frame/dialog, it doesn't wait for the frame/dialog to be closed so coding it after the frame/dialog is dispose should work
But if you use JOptionPane or modal dialog
then this should work
getMsgBox();
//then I requestFocus
lengthTextField.requestFocus();But if you still have problem, u may post your code minus the contents or simplified version so that it will be easier for us to help u
Thanks
Joey
Similar Messages
-
Hi All,
Does anybody know any way to do the setFocus think like in AWT in MIDP? Actually my problem is i am showing three TextFields in my Form where they have to enter some value in them, if any of them is empty i show an alert saying textfield can not be left blank, as soon as the alert expires i want to set my key pad focus on that particular textfield??? I know there isnt any setFocus() method in MIDP but can anybody think of any way arround for this problem??
ManasThe right solution should be to use the setCurrentItem()-method on the Display like this:
midlet.getDisplay().setCurrentItem(yourItem);
The Form that has the Item is set as the current displayable, and it is scrolled so that the Item becomes visible. Focus, if supported by device, moves to this Item.
This works for me the first time I do it, but then it doesn�t. I don�t know why. But hopefully this can help you.
/Tobbe -
Create link to another part of the form
Hi all,
I have created a dynamic form that contains two work plans. Users will fill out one or the other, but not both. I want to provide links to the beginning of each work plan. I cannot reference specific page numbers as the form is dynamic and the page count will change as the form is filled in. What is the code I need to use to do this. I assume I have to reference specific form objects, such as the tables housing the work plans, but I'm not sure what code I need to use.
Thank you in advance.
JenniferJennifer, I use a Button object. First, add a field on the page you want to go to. At the beginning of the work plan add a Button using this JavaScript on the Click Event:
xfa.host.setFocus("Page1.SubformName.TextField");
(change your subform/field names as needed). The field can be visible or hidden. When you click on the button, your cursor will jump to that spot. I use this function to jump through multiple page documents. -
Editable text inside draggable movie clip
I am dinamically creating textfields inside movie clips.
Those movie clips are all dragabble (startDrag).
The problem is that those textfields are supposed to be
editable (input type) but once I attach startDrag to them, it's
impossible for them to get the focus, hence they are not editable.
I tried manually setting the focus on release, but it didn't work
(Selection.setFocus(_root.movieclip.textfield)).
Any help will be rrrrreally appreciated :DWell there does have to be some pixels in the bg clip! (Got
to tease you just a bit, because I run into this ALL the time.)
Some how folks don't take the method at its word.
createEmptyMovieClip() does just that. It creates and empty movie
clip. There are no pixels in it so there is nothing to onPress.
Also I've got a little trick for you – you didn't ask
for it, but it is still free. :)
If you use the MovieClip class' method for
createEmptyMovieClip() it will return a reference to the newly
create clip. You can assign that reference to a variable and use it
again and again. To my eye it makes the code easier to read and
maintain. So your code would change to something like:
var curClip=this.createEmptyMovieClip("mc"+i,1000+i);
curClip.createEmptyMovieClip("bg",100);
curClip.createTextField("myText",2,20,20,"auto","auto");
curClip.myText.text="default value";
curClip.bg.onPress=function(){
this._parent.startDrag();
and so on.
Also I personally think getNextHighestDepth() is a disaster
waiting to happen so I personally never use it. -
Focus grabber in JSpinner creating conflicts with keyboard
Hi all,
I'm stuck with this problem. I'm making a basic 2D game where in some part of the window you can modify a couple of values (speed, angle) through the respective spinners and then shoot by simply pressing a button. I'd like to let the user modify those two values and shoot from keyboard as well, but whenever the focus is grabbed by the said spinners, I'm basically screwed. Is there any practical solution to this?
Thanks!
If this code is of any help:
// constructor
// shootButton is a JButton
shootButton.addKeyListener(this);
public void keyPressed(KeyEvent e)
int event=e.getKeyCode();
if(event==KeyEvent.VK_UP)
initialSpeedSpinner.setValue(initialSpeedSpinner.getNextValue());
if(event==KeyEvent.VK_DOWN)
initialSpeedSpinner.setValue(initialSpeedSpinner.getPreviousValue());
// those JSpinners are defined elsewhere, of course.
}import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import javax.swing.event.*;
public class SpinAndShoot extends JPanel implements ChangeListener {
JSpinner spinner;
Path2D.Double path = new Path2D.Double();
Point2D.Double projectile = new Point2D.Double();
double theta = -Math.PI/4;
public SpinAndShoot(JFrame f) {
path.moveTo(20,0);
path.lineTo(-20,20);
path.lineTo(0,0);
path.lineTo(-20,-20);
path.lineTo(20,0);
registerKeys(f);
public void stateChanged(ChangeEvent e) {
int value = ((Integer)spinner.getValue()).intValue();
theta = Math.toRadians(value);
repaint();
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
double cx = getWidth()/2.0;
double cy = getHeight()/2.0;
AffineTransform at = AffineTransform.getTranslateInstance(cx, cy);
Rectangle r = path.getBounds();
double x = r.getCenterX();
double y = r.getCenterY();
at.rotate(theta, x, y);
g2.setPaint(Color.blue);
g2.draw(at.createTransformedShape(path));
g2.setPaint(Color.red);
g2.fill(new Ellipse2D.Double(projectile.x-2, projectile.y-2, 4, 4));
private void registerKeys(final JFrame f) {
JRootPane rp = f.getRootPane();
int c = JComponent.WHEN_IN_FOCUSED_WINDOW;
rp.getInputMap(c).put(KeyStroke.getKeyStroke("LEFT"), "LEFT");
rp.getActionMap().put("LEFT", leftAction);
rp.getInputMap(c).put(KeyStroke.getKeyStroke("RIGHT"), "RIGHT");
rp.getActionMap().put("RIGHT", rightAction);
rp.getInputMap(c).put(KeyStroke.getKeyStroke("UP"), "UP");
rp.getActionMap().put("UP", upAction);
private Box getControls() {
int val = (int)Math.toDegrees(theta);
SpinnerNumberModel model = new SpinnerNumberModel(val,-180,180,1);
spinner = new JSpinner(model);
spinner.setFocusable(false);
JTextField textField =
((JSpinner.DefaultEditor)spinner.getEditor()).getTextField();
textField.setEditable(false);
textField.setFocusable(false);
spinner.addChangeListener(this);
JButton button = new JButton(upAction);
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalGlue());
box.add(new JLabel("angle "));
box.add(spinner);
box.add(Box.createHorizontalGlue());
box.add(button);
box.add(Box.createHorizontalGlue());
return box;
public static void main(String[] args) {
JFrame f = new JFrame();
SpinAndShoot test = new SpinAndShoot(f);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(test);
f.add(test.getControls(), "Last");
f.setSize(400,400);
f.setLocation(200,200);
f.setVisible(true);
private Runnable fire = new Runnable() {
public void run() {
double phi = theta;
double cx = getWidth()/2.0;
double cy = getHeight()/2.0;
double rangeDistance = getRange(cx, cy);
double pulse = 2, dist = 0;
do {
dist += pulse;
double x = cx + dist*Math.cos(phi);
double y = cy + dist*Math.sin(phi);
projectile.setLocation(x,y);
repaint();
try {
Thread.sleep(30);
} catch(InterruptedException e) {
System.out.println("fire interrupt");
} while(dist < rangeDistance+5);
private double getRange(double cx, double cy) {
int w = getWidth();
int h = getHeight();
double diag = Math.sqrt(w*w + h*h);
double x = cx + diag*Math.cos(theta);
double y = cy + diag*Math.sin(theta);
Rectangle r = getBounds();
double x1=0, y1=0, x2=0, y2=0;
double range = 0;
int outcode = r.outcode(x, y);
switch(outcode) {
case Rectangle.OUT_TOP:
x1 = r.x; y1 = r.y; x2 = r.getMaxX(); y2 = y1;
range = new Line2D.Double(x1, y1, x2, y2).ptLineDist(cx, cy);
break;
case Rectangle.OUT_TOP + Rectangle.OUT_LEFT:
range = Point2D.distance(r.x, r.y, cx, cy);
break;
case Rectangle.OUT_LEFT:
x1 = r.x; y1 = r.y; x2 = x1; y2 = r.getMaxY();
range = new Line2D.Double(x1, y1, x2, y2).ptLineDist(cx, cy);
break;
case Rectangle.OUT_LEFT + Rectangle.OUT_BOTTOM:
range = Point2D.distance(r.x, r.getMaxY(), cx, cy);
break;
case Rectangle.OUT_BOTTOM:
x1 = r.x; y1 = r.getMaxY(); x2 = r.getMaxX(); y2 = y1;
range = new Line2D.Double(x1, y1, x2, y2).ptLineDist(cx, cy);
break;
case Rectangle.OUT_BOTTOM + Rectangle.OUT_RIGHT:
range = Point2D.distance(r.getMaxX(), r.getMaxY(), cx, cy);
break;
case Rectangle.OUT_RIGHT:
x1 = r.getMaxX(); y1 = r.y; x2 = x1; y2 = r.getMaxY();
range = new Line2D.Double(x1, y1, x2, y2).ptLineDist(cx, cy);
break;
case Rectangle.OUT_RIGHT + Rectangle.OUT_TOP:
range = Point2D.distance(r.getMaxX(), r.y, cx, cy);
break;
default: // center = 0
System.out.println("outcode = " + outcode);
return range;
private Action leftAction = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
Object value = spinner.getPreviousValue();
if(value == null)
value = ((SpinnerNumberModel)spinner.getModel()).getMaximum();
spinner.setValue(value);
private Action rightAction = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
Object value = spinner.getNextValue();
if(value == null)
value = ((SpinnerNumberModel)spinner.getModel()).getMinimum();
spinner.setValue(value);
private Action upAction = new AbstractAction("shoot") {
public void actionPerformed(ActionEvent e) {
Thread thread = new Thread(fire);
thread.setPriority(Thread.NORM_PRIORITY);
thread.start();
} -
TabIndex & setFocus issues.
Hi all,
I am having a real issue with getting tabIndex and setFocus
to work with my custom TextInput component. I have tried everything
that I can possibly think of and it just won't work. When I test
the component and set tabIndex or setFocus nothing happens. Any
ideas would be greatly appreciated. Below is the actionscript I
have in my class file. (note: need it to work for fp 7+)
class brownfreelance.components.AdvTextInput extends
MovieClip {
private var _mTextContainer:MovieClip;
private var _tTextBox:TextField;
private var _bTabChildren:Boolean;
private var _nTabIndex:Number;
public function setFocus():Void {
Selection.setFocus(_mTextContainer._tTextBox);
public function set tabIndex(nTabIndex:Number):Void {
_mTextContainer._tTextBox.tabIndex = nTabIndex;
public function AdvTextInput() {
CreateTextBox();
_mTextContainer._tTextBox.tabChildren = true;
_mTextContainer._tTextBox.tabEnabled = true;
_mTextContainer._tTextBox.tabIndex = _nTabIndex;
private function CreateTextBox():Void {
_mTextContainer.clear();
_mTextContainer = createEmptyMovieClip("_mTextContainer",
getNextHighestDepth());
_mTextContainer.createTextField("_tTextBox",
getNextHighestDepth(), 2, 2, (_nWidth-2), (_nHeight-1));
Thank's in advance.On Thu, 6 Sep 2007 12:51:09 +0000 (UTC), "fourthleaf"
<[email protected]> wrote:
>I have been having two issues with Dreamweaver over the
last week.
>
> First - it freezes after one upload, any time of file.
One goes fine and then
>the next time I try to upload it just gets "caught". The
upload box comes up,
>but never goes anywhere and it's unsuccessful. Seems like
the only way to fix
>it is to shut down and restart. (Which I usually have to
do because all of
>Dreamweaver then freezes.)
>
> Also, the files that I did upload are not showing live.
They show in the
>remote server has having been uploaded, but when I try to
view the files
>on-line, they do not appear. I have refreshed, cleared my
cache, everything...
>but the files are not updated or uploaded.
>
> Any ideas?
>
>
I would try a different server, maybe that one is choking. -
DateTimeField and an additional TextField
I have a combination of a textfield and a datetimefield. The user can select any date in the textfield and he can choose a date from the calendar. When the user select the date via the calendar the value of the textfield will be set to the selected date. Now my problem: how can I make the picker (the dropdown arrow) of the calendar visible when clicking the textfield? My first try with execute the click-event of the dattimefield wasn't successful. Anybody experiences or suggestions?
The only time the dropdown arrow will become active is when focus is put onto the field. Obviously you cannot have focus on the DateTime Field while you are filling the other field so I do not see how you can do this. You can however put focus on the DateTime field on exit of the text field by either modify the tabbing order or adding script to the exit event of the TextField. You would add this code:
xfa.host.setFocus("FieldName");
Hope that helps -
SetFocus wont work after setting presence="invisible"
Hi,
i got a form with a button in it, that should jump to a combobox on another page which is hidden by setting this.presence="invisible" in its initialize event. The code in the click event of the button is the following:
comboBox1.presence="visible";
xfa.host.setFocus("comboBox1");
it does setting the presence to visible, but the setFocus seems to be ignored. When i click the button the second time, it will jump to the specified item.
Same phenomenon the other way round. When a value in the comboBox is chosen, i want the value to be copied to a textfield, set the presence of the combobox to invisible again, and return to the button with another setFocus instruction. To reach this, i did the following in the exit event of the ComboBox:
if(this.rawValue){
textField1.rawValue = this.rawValue;
this.presence="invisible";
xfa.host.setFocus("button1");
the value and the presence got set, but (again) the setFocus instruction seems to be ignored.
it all works fine, if i outcomment the presence assignments. Could somebody tell me the reason why it wont work this way?Ok, you have some script problems going on. I've attached a new file with them fixed up.
When you are in the Script Editor and want to get the path to another object use the CTRL key and click on the object whose path you are trying to get. Your cursor needs to be in the Script Editor and you need to be able to see the object you are trying to click on. When you hold down the CTRL key and mouse over a valid object it will turn to a "V" - click on the object and the path will be inserted in your script.
So, where you had:
DropdownListe1.presence="visible";
xfa.host.setFocus("DropdownListe1");
It should be:
xfa.resolveNode("#subform[1].DropdownListe1").presence="visible";
xfa.host.setFocus(xfa.resolveNode("#subform[1].DropdownListe1"));
File attached - I moved the second subform to the first page so it was easier to see what was going on.
The code on the dropdown list looks a little odd, but I'm not sure exactly what you're trying to do - seems to work though. -
Hi,
I have the following problem:
On my stage sits a MC: personTab.nameBase. Inside the
nameBase clip there are 10 input fields named input## (numbered
from 0 - 9).
When I click one of these fields the cursor starts blinking
in the field which is clicked. This is OK, but the problem is that
the field doesn't loose focus unless a component is clicked
(radiobutton, combobox etc.).
I put in a listener to trace what happens:
In the onSetFocus event I get the target of the clicked field
and when I click the mouse somewhere on stage (where no component
is placed I get null as a target, but when I release the
mousebutton, the last selected field receives focus again and the
target of the field is returned again (instead of null). The
onKillFocus event doesn't return a thing. I already tried handling
the focus in the onSetFocus event in the following manner:
var clip:Array = newFocus._name.split(".");
if (substring(newFocus._name, 1, 5) == "input") {
var clipID:String = substring(newFocus._name, 6,
newFocus._name.length);
_global.activeField = clipID;
} else {
if(!newFocus._name){
//remove focus from textFields
Selection.setFocus(null);
delete _global.activeField;
But there is no response to Selecion.setFocus(null), the last
selected input field keeps getting focus after the mouse is clicked
on somewhere else on stage (but not on a component, or other text
field).
I hope someone can help me out. Thanks in advance.
Best regards,
Rick.onRollOver (your button) you store the begin and end index of
the Selection (in the textfield), onRelease(of your button) you set
your red textFormat on the previously stored indices, then you set
Selection.setSelection back to what it was... -
TextField doesn't get focused directly using Firefox
I have a login dialog which contains userNameInput textField. Upon the application load, I want the userNameInput be fucused and cursor blinking. And I can type without clicking on the screen.
In loginDialog.as, creationComplete I have
callLater(setDefaultFocus, new Array(null));
And setDefaultFocus function:
focusManager.setFocus(userNameInput);
focusManager.showFocus();
This works perfectly in IE. But it's not working in Firefox.
Can anyone tell me why this is not working in Firefox? Is this a Flex issue or Firefox issue? And is there any work around exist?
I've searched online and tried the following ways, no one works so far.
1. stage.focus = userNameInput;
2. navigateToURL(new URLRequest("javascript:document.getElementById('UxFlashApplication').focus();"),"_self");
3. userNameInput.setSelection(userNameInput.length, userNameInput.length);
I've also tried set wmode to opaque, this works but it breaks something else in the application ( e.g. mouse scroll), I prefer not to do anything with wmode.
Envoironment: Flex 3/4, windows 7, Firefox13 and 16
Any help would be appreciated!Having the same problem. Trying to work out if the 3GS has an actual moving part in the camera to focus or whether it 'sharpens' it digitally... I'll keep you posted if I find out
-
Urgent Pls... Textfield validation
Hi All,
In a textfield its should accept two conditions i.e.,
1) It should accept 10 digits or
2) In a field it should accept two chars and 5 digits. or than that its should pop up an alert.
I have tried setting patterns and worte the script in exit event:
if(this.rawValue == this.formattedValue)
xfa.host.setFocus(this.name);
But the setFocus is going again and again.
Patterns: text{AA99999}|text{9999999999}
Please help.
Thanks in advance
Regards,
ApurvaHi Apurva,
You need regular expression for this. Remove all the validations of the text field first i.e display,edit,validation,data.
In the exit event of the field put the following script.
var vPattern = /^([a-zA-Z]{2}[0-9]{5})$|^([0-9]{10})$/;
var result = vPattern.test(this.rawValue);
if (result == false)
xfa.host.setFocus(this.name);
Thanks,
Bibhu. -
Setting focus to textfield when program is first launched
I'm getting really mad. Everything is working fine. But, one little thing and its is suppose to be really simple. I must be some kind of an idiot if I can't see what the problem is for this. Anyway, I'm trying to set the cursor/focus on my text field when the program is launch. But, it seems that everyting that I try appears not to be working. I now have some junk code in my program. But, I was hoping that my attempts were getting me close to what I want. Below is my code. I'm hoping someone can tell what I'm doing wrong.
import java.io.*;
import java.awt.*;
import java.awt.event.*;
class ChatClient extends Frame
private TextField tf1 = new TextField("", 50);
private TextArea ta;
private Button sendButton;
private Button quitButton;
private MenuItem exitMT, aboutMT;
private Choice choice;
private String user;
public ChatClient()
super("ChatClient");
addWindowListener(new WindowAdapter()
{public void windowClosing(WindowEvent e) {System.exit(0); }});
setTitle("Chat Room");
Panel p = new Panel(new BorderLayout());
Panel p1 = new Panel(new BorderLayout());
Panel p2 = new Panel(new GridLayout(3,1));
MenuBar mb = new MenuBar ();
setMenuBar (mb);
Menu fileMenu = new Menu ("File");
mb.add(fileMenu);
Menu helpMenu = new Menu ("Help");
mb.add(helpMenu);
fileMenu.add (exitMT= new MenuItem ("Quit"));
helpMenu.add (aboutMT = new MenuItem ("About"));
exitMT.addActionListener(new ExitCommand());
aboutMT.addActionListener(new AboutCommand());
//creating main panel
add(p, BorderLayout.NORTH);
ta = new TextArea(10, 50);
add(ta, BorderLayout.CENTER);
ta.setSize(500,300);
ta.setEditable(false);
ta.transferFocus();
//adding buttons and choice box to the right side of the window
sendButton = new Button("Send");
Panel p3 = new Panel();
sendButton.setSize(15,15);
sendButton.setBackground(Color.green);
p3.add(sendButton);
p2.add(p3);
sendButton.addActionListener(new CopyCommand());
quitButton = new Button("Quit");
Panel p4 = new Panel();
quitButton.setSize(15,15);
quitButton.setBackground(Color.red);
p4.add(quitButton);
p2.add(p4);
quitButton.addActionListener(new ExitCommand());
Panel p5 = new Panel();
choice = new Choice();
choice.addItem("John");
choice.addItem("Jena");
choice.addItem("Colleen");
choice.addItem("Steve");
user=choice.getItem(0);
p5.add(choice);
choice.addItemListener(new CopyCommand());
p2.add(p5);
add(p2, BorderLayout.EAST);
//adding the textfield to the south end of the window
p1.add(tf1);
tf1.isDisplayable();
tf1.setFocusable(true);
tf1.setVisible(true);
tf1.requestFocus();
add(p1, BorderLayout.SOUTH);
tf1.addActionListener(new CopyCommand());
//handling ActionEvent from buttons and menu items
class ExitCommand implements ActionListener
public void actionPerformed (ActionEvent e)
tf1.setText("");
ta.setText("");
choice.select(0);
System.exit(0);
class AboutCommand implements ActionListener
public void actionPerformed (ActionEvent e)
System.out.print("About menu was pressed!");
class CopyCommand implements ActionListener, ItemListener
public void itemStateChanged(ItemEvent e)
{ if (e.getSource() instanceof Choice)
user = (String)e.getItem();
public void actionPerformed (ActionEvent e)
ta.append(user + ": " + tf1.getText() + "\n");
tf1.setText("");
tf1.requestFocus();
public void keyPressed (KeyEvent ke)
//figure out if the enter key was pressed
if (ke.getKeyCode() == KeyEvent.VK_ENTER)
ta.append(user + ": " + tf1.getText() + "\n");
tf1.setText("");
tf1.requestFocus();
public void keyTyped (KeyEvent ke) { }
public void keyReleased (KeyEvent ke) { }
public static void main(String[] args)
{ Frame f = new ChatClient();
f.setSize(600, 400);
f.show();
}Bingo!
Hi , I am trying to make a chat application too I dont know its exactly like yours or not......I need to make it for the chat support of a website (like in some sites you have online chat with chat center guy's). For that reason I had to make it an applet , although i want to use frame but i do then how i will embed it in the web page? I encountered with the same problem you are facing but didnt solved it yet cause i have bigger problems than that. tell me you have solution.
Plz visit the following threads:
http://forum.java.sun.com/thread.jspa?threadID=611865
and
http://forum.java.sun.com/thread.jspa?threadID=607639
Thankyou
Regards
Manu -
Why my textfield can not get focus?
I put a textfield on the first tab of a tabbed panel. I need this textfield to get the focus when I open the first tab. I tried to use grabfocus() method in the constructor of class, but it does not work. Does anybody know why? and how can I solve it?
Thanks!No, I didn't call grab/requestFocus on the event thread.
My code is like this:
public class GeneralPane extends JPanel {
JPanel ltPane;
private JTextField txtCountry;
public GeneralPane() {
initComponents();
private void initComponents(){
setLayout(new BorderLayout());
//Add another Panel to contain Labels and Text fileds
ltPane = new JPanel();
FocusListener mFL = new FL();
txtCountry = new JTextField("US", 20);
//this listener is used to store the data in the textfield into a variable
txtCountry.addFocusListener(mFL);
// add the textfield into ltPane
mUtil.insertTextPane(txtCountry,ltPane);
//txtCountry got focus
//txtCountry.setFocusable(true);
ltPane.requestFocus();
//txtCountry.requestFocusInWindow();
Then in the main program, I create an instance of this class and then use addTab(...) function into the my tabbedPanel.
The logic is simple, but the textfield still couldn't get focus when I open the tabbedPanel. -
Selection.setFocus(null)
I have a movie clip that holds a text field that can be
changed either by typing in to it or clicking buttons (also
contained in the movieclip). Once the text field has focus there
seems to be no way of getting rid of it other than clicking in
another field. I have tried using Selection.setFocus(null) and this
appears to kill the focus but it is returned straight away and
while the field has focus the button input fails.
I am stuck, any thought welcome
Cheers allthere must be some event that triggers your textfield to
loose focus. that can be any user action or a timer or anything
else that occurs within your swf or anywhere that your swf can
access. at that point your code should work. -
Selection.setFocus();
Why is this one so hard. There are a couple dozen posts out
there but nothing I have tried works. So here it is.
An input textbox onScreen with an instance name of: myText -
that's it. // no text in the box.
Running the following script in the action layer in frame one
I have:
Selection.setFocus("myText");
Selection.setSelection(0,0);
This needs to run on Flash Player 6 so I am shying away from
getCaretIndex(); and a few other scripts I have seen.
I'll keep digging around, but by the looks of ALL the
questions and postings - this problem has been around for awhile.
Does ANYONE have an actual working input textbox
(test/sample) I can look at? (I am using FlashPro8)orion.doty,
it's just the line Selection.setFocus("textfieldname") and
the fact that Flash has focus that make the cursor blink. I tried
with publish settings for player 6 & 8, both AS 1 and AS 2,
they all work fine in player 8 on Windows. I don't know if maybe
the Mac player behaves different... In Win it doesn't matter if
it's the plugin or the standalone player.
Try a little testmovie: in frame 1, place a stop() and a
button that has nextFrame() onRelease. In frame 2, place the
textfield, and add Selection.setFocus("textfieldname") to the
frame's actions. If you test the movie, the cursor should blink
when you pressed the button and the movie enters frame 2. It won't
work if you leave out frame 1 with the button, so I guess Flash has
to receive the focus through a click inside it to highlight the
focused selection.
hth,
blemmo
Maybe you are looking for
-
I own a LENOVO G560 laptop. I bought it on 23-6-2010. This shows that I have warranty covered till 23-6-2011. Now I got a problem in my laptop and i took it to service center. the service person told me that MOTHERBOARD IS TO BE REPLACED, and also he
-
Urgent!!!. Need Help with @@identity
Hi, I am migrating T-SQL queries to PL/SQL. I have some queries in SQL Server like "Insert into tble(col2, col3, col4) values(val2, val3, val4);select col1, col2, col3 from tble where col1=@@identity" When I use Sql developer @@identity is replaced w
-
Sony AVCHD (MTS) shimmering lines issue (moire? aliasing?)
I have just started working with AVCHD / MTS source files (29.997 fps, 1080p) and have been experiencing a problem with shimmering straight horizontal or diagonal lines. The source files look fine, but upon exporting / converting to a common format f
-
Just got a G4 and would like to use an old LaserWriter with it but do not know about drivers. Can some one be so nice as to "walk" me through downloading the drivers from the Apple site and loading them on my G4. I am using OS 10.2.8
-
Custom field in enjoy transaction
Hi, How to add a custom field in enjoy transaction. In my case iam concerned with EBAN- Me51n - Purchase Req. can we configure from field selection groups, if we have the field in EBAN. I doubt , but i would like to hear from you guys too. Thanks Sa