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
Similar Messages
-
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() weirdness
Hi All,
I am getting a bug in Flash player and also in the Flash Test
Movie publish involving the Selection.setFocus() method (authored
using Flash 8).
I have 3 movie clips that require focus toggled between them
via keyboard directional arrow input. Those clips are:
- musicVolume_mc
- effectsVolume_mc
- speechVolume_mc
I initially set the focus to the first movieClip:
Code:
Selection.setFocus("musicVolume_mc");
and then each movieClip uses the following code example
placed on the clip itself to target the next clip;
Code:
on(keyPress "<Up>"){
Selection.setFocus("_parent.speechVolume_mc");
on(keyPress "<Down>"){
Selection.setFocus("_parent.effectsVolume_mc");
Trouble is, the focus doesn't get passed as you would expect
between each of the 3 clips, it gets stuck and jumps to the wrong
clip....it's quite strange and frustrating. Has anyone had this
issue?
What do other people use to set Focus between movieClips
reliably..?
thanks
mitchellthanks for your reply,
I managed to solve the problem by disabling the tabEnabled
setting with is by default set to "true" and clashes with keyboard
arrow input..
Code:
instanceName.tabEnabled=false;
Also, if anyone else has this issue in future, relative paths
inside the setFocus parameter didn't work for me....so use absolute
ones instead, as in the following example.
Code:
Selection.setFocus("_root.audioOptions.effectsVolume_mc");
cheers -
Selection.setFocus listener
Hi there!
How do I write a listener which can trigger the opening of a
MovieClip ( myMc.gotoAndStop(2) ) when Tab Selection occurs on a
given TextField ?
Many thanks in advance for your help!
Regards,
GerryHi kglad !
I did it this way (see attached code).
But got no result...
More : it makes my page (frame) unresponsive. -
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. -
Hi
I need to make the cursor blinking on thet textinput
component when i run the flash file... at first
~~
SkHi
i am placing code on the main time line but it's not running
fine...
i kept the textinput component in the firstframe and code
also in the firstframe..
but the cursor is not blinking in the textinput component.
this.onSetFocus=function(){
Selection.setFocus(tf);
or else i need to do any change
can you please tell me...
~~SK -
I have made one loging screen in Flash there I am setting
focus for the Email Field first when the page loads.
Following are the lines of code I have used
Selection.setFocus("emailBox");
Now the problem I am facing is it works fine Flash Authoring
environment but it does not works in the Browser unless user clicks
on the swf object anywhere.
http://beta.thescoutingedge.com/index.php/clogon1
Please help me out and also let me know your comments about
the site look and feel.Well I don't see your code, but, "Yup, that is how it works."
As far as I know the swf has to get focus fromt he user
before you can setFocus on any object. -
Automatic select textbox / textfield ?
Hello,
Is it possible to get an automatically focus on a textbox (or
textfield) in Flash?
I tried this:
Selection.setFocus(input_txt);
Selection.setSelection();
where input_txt is the instance name of the textfield.
It does not work?
Does anyone know how to do this?
Regards,
Micheal.Hi,
Try this.
Selection.setFocus("input_txt");
instance name of the textfield should be within doublecodes.
It works when you run the swf file seperately
GHMS -
SetFocus() causing an infinite loop? is this a known thing?
hi folks
i've just started revising a site of mine (
http://www.darkeststar.co.uk)
using flash cs3 (was originally in mx2004) and i've come across
some strange behaviour from one of the components
when i test the combo box, it freezes and gives
Code:
256 levels of recursion were exceeded in one action list
as an error. This is strange because when i was using mx2004,
there was no problem.
Now, when i get rid of a setFocus() used on a TextArea
component immediately afterwards, the problem is corrected
(although the user cannot type directly in the textbox and has to
click in it first which is awkward imo)
is this a known thing? i haven't used the built-in components
much before now but they've been almost as much hassle as they've
solvedThe way that I have always used setFocus() is this
Selection.setFocus(itemOverlay_mc.amountTextArea_txt);
Maybe the functionality has changed since mx2004. Try that,
see what happens -
SetFocus messes up key listener
I have a textfield attached to a movieclip attached to a
movieclip on the stage. I have an object set to listen for key
events, and that object defines an onKeyDown function. If I run the
movie and click on the textfield manually, a cursor appears in the
textfield, and when I enter text the onKeyDown function executes.
If instead I use Selection.setFocus(myTextfield), the cursor
does not appear, but I can still type text in the textfield.
However, this apparently makes a big difference, because now the
onKeyDown function in the key-listener object does not execute. Is
there a way to programmatically set focus and still have key
listeners work? What is the difference between the
Selection.setFocus kind of focus and the other kind of focus when a
cursor appears?create an array. it's quick and easy if you work cleverly.
create an empty array and push your ascii keypress codes into
it. then test your project and keypress the numbers and letters in
the order you want them to be listed in your array.
when you're finished trace your array (in order), copy the
output panel and in the authoring environment paste your ascii
array. -
Unable to set focus to login text field AUTOMATICALLY on page load
Hi,
I'm trying to have my flash (AS 2) login page have the
username field start blinking right away after the page is loaded
but so far, no success.
I've added the following Javascript to the HTML wrapper:
But it still doesnt work. Can anyone help?
See whats happening by
clicking here.Use the following in the Flash code:
Selection.setFocus(username_field_instance_name); -
Problem with setSelection and components
Hi! I have a problem with setSelection function when there is
any component on the stage or in the library. Just look on the
sample
here The first
button sets focus and sets selection, the second one removes focus.
It works good, but add any component to break it. Is there any
other way to unset focus? Maybe this is the problem... Any help?
BTW Sorry for my english :)Selection.setFocus(component) removes current
selection -
Hi-
I found a contact form for my Flash website but it's not working properly. It uses ActionScript 3 and PHP, both of which I don't know much about. Because of this, I can't pinpoint the problem or how to fix it. Here's what's going on:
1) Each field in the form only allows 3 characters and no special characters such as @ _ ! . , etc...
2) When the user goes to the next field in the form, the previous field appears blank but the when clicking on that again, the original text appears.
3) When submitting the form, it just keeps saying "in progress" and never shows the confirmation text nor does the email get sent. There is an HTML file included with this form but I am not sure if I need to put that in as I have embedded this form into an SWF file so I don't think I need that code but please let me know if I am wrong about this.
I am posting both the AS code and PHP code below.. if someone can help me figure this out I would greatly appreciate it. I am not sure which file the problem is in. If someone here doesn't know PHP then at least see the AS code and let me know if the problem is in that or not. That way I can pinpoint which file the problem is coming from and then seek further help if needed. To see the form in action, go here: http://www.poojasdesigns.com/ and click on "Contact Me".. here are the codes:
ActionScript 3.0
//presistant reference to this movie's mail timeline:
var mainTL:MovieClip = this;
//start off with submit button dimmed
submit_mc._alpha = 40;
//create the LoadVars objects which will be used later
//one to send the data...
var dataSender:LoadVars = new LoadVars();
//and one to recieve what comes back
var dataReceiver:LoadVars = new LoadVars();
create listener for Key Object
this is just a U.I. thing - "wakes up" the submit button
when all fields have at least some content
var formCheck:Object = new Object();
formCheck.onKeyUp = function() {
if (name_txt.text != '' &&
email_txt.text != '' &&
subject_txt.text != '' &&
message_txt.text != '') {
//clear any alert messages
alert_txt.text = '';
//enable the submit button
submit_mc._alpha = 100;
} else {
//remain disabled until all fields have content
submit_mc._alpha = 40;
Key.addListener(formCheck);
/*#######SET STYLES FOR TEXT FIELDS#######*/
//define styles for both normal and focussed
//set hex values here that work with your site's colors
var normal_border:Number = 0x000000;
var focus_border:Number = 0xFA8D00;
var normal_background:Number = 0xFFFFFF;
var focus_background:Number = 0xE9E3E3;
var normal_color:Number = 0xFFFFFF;
var focus_color:Number = 0x000000;
//create an array containing the fields we wish to have styles applied to
inputs=[name_txt,email_txt,subject_txt,message_txt];
a "for in" loop now iterates through each element in the "inputs" array
and applies our "normal" formatting to each input text field
for( var elem in inputs) {
inputs[elem].border = true;
inputs[elem].borderColor = normal_border;
inputs[elem].background = true;
inputs[elem].backgroundColor = normal_background;
inputs[elem].textColor = normal_color;
/*this takes care of applying the "normal" style to each of the four input fields;
the following TextField prototypes handle highlighting when an input field
gains focus and resetting to normal when a field loses focus*/
inputs[elem].onSetFocus = function() {
this.borderColor = focus_border;
this.backgroundColor = focus_background;
this.textColor = focus_color;
inputs[elem].onKillFocus = function() {
this.borderColor = normal_border;
this.backgroundColor = normal_background;
this.textColor = normal_color;
//finally: make the first field (name_txt) selected when the movie loads
Selection.setFocus(name_txt);
/*DEFINE SUBMIT BUTTON BEHAVIOR*/
submit_mc.onRelease = function() {
//final check to make sure fields are completed
if (name_txt.text != '' &&
email_txt.text != '' &&
subject_txt.text != '' &&
message_txt.text != '') {
alert_txt.text='';//clear any previous error messages or warnings
//advance playhead to frame 2 - the "processing" message
mainTL.play();
//assign properties to LoadVars object created previously
dataSender.name = name_txt.text;
dataSender.email = email_txt.text;
dataSender.subject = subject_txt.text;
dataSender.message = message_txt.text;
//callback function - how to handle what comes abck
dataReceiver.onLoad = function() {
if (this.response == "invalid") {
mainTL.gotoAndStop(1);
alert_txt.text = "Please verify your email address - it appears to be incorrect."
} else if (this.response == "passed") {
mainTL.gotoAndStop(4);
//now send data to script
NOTE: the line below presumes the Flash swf file and php script are in the
SAME DIRECTORY on your server. If this is not the case (if for example you
wish to put the php script along with other similar items in a "scripts"
directory) you MUST MODIFY THE PATH. Otherwise the Flash movie won't be
able to locate the php script.
dataSender.sendAndLoad("processEmail.php", dataReceiver, "POST");
} else {
//warning if they try to submit before completing
alert_txt.text = "Please fill out all the fields before submitting the form.";
PHP
<?php
//create short variable names
$name=$_POST['name'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$message=$_POST['message'];
$name=trim($name);
$email=trim($email);
$subject=StripSlashes($subject);
$message=StripSlashes($message);
/*my email address - dummy address inserted for privacy in this forum*/
$toaddress='[email protected]';
if (preg_match ("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i", $email)) {
mail($toaddress,$subject,$message,"From: $name <$email>\r\nReply-To: $email\r\nReturn-Path: $email\r\n");
//clear the variables
$name='';
$email='';
$subject='';
$message='';
echo "response=passed";
else {
echo "response=invalid";
exit;
?>
Please let me know how to proceed. Thanks so much!
*Pooja*You say you don't know much about AS3, and that you have embedded this form into an swf. In what manner did you embed it, and what version of AS does the swf use? Have you tried using the form in the page that was provided as a standalone test to see if it works?
-
Is there any way to detect when control-a or control-c is
pressed (that is, hold down control key, press A key). The
following code to detect a control-7 works fine:
function myOnKeyDown() {
// 55 is key code for 7
if (Key.isDown(Key.CONTROL) && Key.getCode() == 55)
Selection.setFocus(my_btn);
my_btn.onPress();
but if you change it to "== 65", it never fires. I've also
found if I collect and log all keystrokes with an onKeyDown
listener, the control keys (code 17) always register, but the
following letter never does.
Help! Thanks!
David
p.s. no, I don't think this is a Disable Keyboard Shortcuts
issue. The same problem occurs whether I'm in the flash environment
or in a browser.David Fostor wrote:
> Is there any way to detect when control-a or control-c
is pressed (that is,
> hold down control key, press A key). The following code
to detect a control-7
> works fine:
>
> function myOnKeyDown() {
> // 55 is key code for 7
> if (Key.isDown(Key.CONTROL) && Key.getCode() ==
55) {
> Selection.setFocus(my_btn);
> my_btn.onPress();
> }
> }
>
> but if you change it to "== 65", it never fires. I've
also found if I collect
> and log all keystrokes with an onKeyDown listener, the
control keys (code 17)
> always register, but the following letter never does.
>
> Help! Thanks!
>
> David
>
>
> p.s. no, I don't think this is a Disable Keyboard
Shortcuts issue. The same
> problem occurs whether I'm in the flash environment or
in a browser.
>
The problem could be that you use THE MOST standard short
cuts which in every application
there is out there, are use for Select All and Copy. Perhaps
the program simply has priority
when comes to these key and you can't force it to overwrite
these preferences.
I had a client while back who needed software simulation and
all the function key to work,
like F1 etc... We did manage to fix that on one machine but
whoever else run that, F1 would
bring Help files, if not browser than windows so you could
get it to work on some machine but
not all. Perhaps new set of key combo you could consider.
Regards
Urami
Happy New Year guys - all the best there is in the 2006 :)
<urami>
http://www.Flashfugitive.com
</urami>
<web junk free>
http://www.firefox.com
</web junk free> -
How to maintain focus in input text box?
I am a complete newbie with Flash MX, ActionScript, and
everything in between. So here's my situation.
I want to make it so the user has to type in a password to
move forward with the Flash presentation. When he presses OK, it
takes him to further into the presentation (i.e. Frame 20).
On my login screen, I have a couple of layers that are
animated. Thus, I need these animations to keep looping. So what
did I do? At the end of the animation, I put in code to
GotoAndPlay(1).
Now here's the problem... When someone's trying to type in
the password, when it loops (Gotoandplay), the input box loses
focus. To remedy this situation, for frame 1, I put in the code:
Selection.setFocus("txtPassword").
What happens? Everytime it sets focus, everything gets
highlighted in the input text field.
As you can imagine, it is a headache for anyone who is trying
to type in the password because every few seconds, the whole thing
gets highlighted and he accidently types over it.
Any suggestions?1. copy the frames of your looping animation.
2. create a new movieclip and paste those copied frames onto
this movieclip's timeline
3. from your library drag a copy of the above movieclip to
frame 1 of your main timeline and attach a stop() to that frame.
4. place your login textfield and ok button on frame 1 of
your main timeline.
5. when ok is pressed (and login) passes some condition
direct your main timeline to frame 20.
Maybe you are looking for
-
Can iCal update while closed?
OK, here's my problem: When I enter an event on my iPhone or iPad or on me.com, it only shows up in iCal after I open iCal. In other words, if I associate an alert with an event on my phone, that alert will never go off on my Mac, unless I left iCal
-
Changing the Decimal places in the currency
Hi all we are using the currecy SAR. Decimal places was set to 4, now that they want to revert back to 2 decimal places. i understand that by doing so they would be inconsistencies in the data allready recorded. how to avoid that? is there any progra
-
JTable with JButton Cell renderer
How can I get buttons (JButtons) to "depress" properly in a JTable when using them as the cell renderer for a specific column in a JTable? Currently when pressing any button in the column, there is no change in the visible state of the button, i.e. i
-
Hi Experts, I am new for adobe form i have developing one form that is having 2 master pages. if the line items less then 4 i have to display them in 2end page (items displaying second page is working fine but still the 1st page displaying with empty
-
Error 11556 when trying to convert songs to ringtones
i have bought a song from itunes to turn it into a ringtone for my iphone but when i try to convert the song into a ringtone i get this message. itunes could not connect to the itunes store, and unkown error occured (11556). i have heard you can't ma