Cursor Insert problem

This function won't work - Selection.setFocus("text1");

Using Flash MX 2004
text box properties = input
instance = emailx
var = email

Also, all the code underneath it executes fine and it doesn't work on other input boxes as well.

Any ideas?
Who is Participating?
fixitbenConnect With a Mentor Commented:
Try this Place this in the Same frame with the text box


You have to point to the instance not the Var. Duh


the path ..("???") a literal string to the variable
it can be relative or absolute

so if the textfield is on the main timeline.. the code would be..

Selection.setFocus("email");  //relative


Selection.setFocus("");  //absolute

or if the field was in a clip called .. clipOne ..

Selection.setFocus("");  //absolute


DocjaymanAuthor Commented:
Yeah, I tried all of those but it still doesn't work.  I also tried using other text boxes but still nothing.  I am not sure what it could be because the code is so simple.
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Have you tried it without the quotes?  It seems to work equally well with or without!

Also try this before the setFocus, to check whether your path is correct:


and if you get "undefined" in the output window, try the other suggestions that Zeffer made ( i.e. trace(; ).  If it always comes up undefined then this is your problem, and you can use:


to give you the path you need.
Just something else You won't see the cursor inside flash you will only see it once inserted into a webpage or just playing the swf by its self.  

DocjaymanAuthor Commented:
If someone could email me at, I would be happy to attach the small file.  Maybe I am just missing something really dumb.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.