GetFocus On Movieclip In Flash 5
I am trying to selection.getFocus() on a movie clip in flash 5. However, it returns null. Any thoughts on this?
What I am really trying to do is to set the focus on a button in my tab order but Flash 5 won't allow me to set an instance name on a button so I put it in a movie clip.
ActionScript.org Forums > Flash General Questions > Other Flash General Questions
Posted on: 01-22-2003, 04:40 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
TextField, GetFocus In A MovieClip
Does anyone have a working fla. that has a textfield in a Movieclip, and in which that textfield has focus?
Put more clearly, I have a textfield in a Movieclip, and I want the textfield to have focus. I have the textfield working superbly when it's not in the Movieclip, but once I drop it in a Movieclip, the textfield doesn't have focus...
I just started playing with Flash again after a 2-year layoff, so I have to get back up to speed with actionscript again...
In any event, can anyone post a fla. or the code that would work...keep on flashing...
Flamboyant Flasher
GetFocus() Movieclip Problems
Hi,
I cant seem to get Selection.getFocus() to work for a movieclip or button but it works fine for a text field...
any suggestions?
Textfield, GetFocus, Movieclip
Does anyone have a working fla. that has a textfield in a Movieclip, and in which that textfield has focus?
Put more clearly, I have a textfield in a Movieclip, and I want the textfield to have focus. I have the textfield working superbly when it's not in the Movieclip, but once I drop it in a Movieclip, the textfield doesn't have focus...
I just started playing with Flash again after a 2-year layoff, so I have to get back up to speed with actionscript again...
In any event, can anyone post a fla. or the code that would work...keep on flashing...
Jay
Flash's Selection.setFocus() / .getFocus()
Hey all,
Ok here's one for y'all... i've got several dynamic fields and i'd like to know which one is being clicked. Using the Selection.getFocus() seems to work, only that when i trace it with this code placed on an MC on the same layer:
onClipEvent(mouseDown) {
trace(Selection.getFocus());
}
it gives me the name of the previous variable clicked. To get the result i want, i need to double click the field which poses a huge imprecision problem. Since this Object is global, it's not the path.
I've tried Selection.setFocus("dummyVariable") in case it was general problem (such as the last focus was the background and the field can't do anything with that for example...).
I tried it on a new SWF in case it was the complexity of the original... nope.
Other posts have discussed this but not in Flash only. They use javascript and have concluded that Netscape seemed to have problems with this. So if anyone's got any ideas that'd be cool especially if it can be arranged with a piece of code.
Thanks!
GetFocus
I don't get this. What would I need (actionscript) for getting the focus of a text INPUT BOX. When the user clicks (selects) on the input box, i want the preveous data there (whatever was there before he/she clicked it), to vanish, and they can just start typing. Please help.
Thanks,
alex
GetFocus
I have a frame with an input text field: input1_txt
what I need to do is, when the user clicks in the field, tell the timeline to go to the next frame. I am using onChanged, becuase I do not want the user to type anything. if they do they get incorrect feedback.
I had:
code:
if (getFocus() == "_level0.input1_txt){
nextFrame();
}
but it didn't work, I need some sort of loop or listner to keep checking until the field gets focus
any ideas
IMS
GetFocus()
I am having problems with the getFocus() function
myScript is
Selection.getFocus(this.myName);
but it is not setting my cursor on the text field automaticlty
myName is the variable of my textfield
GetFocus
I am having problem getting the focus on a particular text field in flash
my text field is in the same place as my code in the timeline
my Code :
Code:
Selection.getFocus(this.myName);
//myName is the variable name
but it does not work
GetFocus
Code:
on(release){
_root.whatisit.text= Selection.getFocus();
}
This code should put target path of the movie clips that I click on in the dynamic text box whatisit. Instead I only get "null"
Anyone know why?
Using Selection.getFocus();
onClipEvent (mouseUp) {
textSelect = Selection.getFocus();
trace(textSelect);
}
I am using tha code above to find out what text area is selected is gives me a trace of for example:
_level0.input
When I use my var textSelect to target one of the text areas it does not work - anyone know why?
Cheers
Rich
GetFocus() Problem
I try to controll cursor position in a contact form by using <TAB> key.
The code which i use it is from flashkit tutorials:
on (keyPress "<Tab>") {
if (Selection.getFocus() == "_level0.field1") {
Selection.setFocus("_level0.field2");
} else if (Selection.getFocus() == "_level0.field2") {
Selection.setFocus("_level0.field3");
} else if (Selection.getFocus() == "_level0.field3") {
Selection.setFocus("_level0.field4");
} else if (Selection.getFocus() == "_level0.field4") {
Selection.setFocus("_level0.field1");
}
}
My problem:
The contact form is in a movie and when I try to change that _level0 in my path the script doesn't work. Why???
Mouse.getFocus( ) ? Help
On my HTML page, when the users mouse leaves my swf, the last button highlighted stays lit. (The buttons hit areas extend to the edge of the swf.)
Is there a way to have flash check if the mouse has left the swf?
I tried making the button fade after 2 seconds of mouse inactivity, but that seems like a kludge solution... Anyone got a better one?
Thanks,
-J
SetFocus / GetFocus
Hi, I've got 6 input boxes, named input1 through input6.
How do I get it to cycle through focus on each at the press of "tab"? Also, if possible, have the focus set on the first box at the start.
I've done a bit of Googling, but nothing's worked.
Any ideas?
GetFocus And Formatting
I have some textAreas and want to apply custom formatting on actually selected texArea..
Here is my code:
Attach Code
var pole:Array = new Array("prvni text", "druhy text", "treti text", "ctvrty text");
var souradnice:Number = 50;
var my_fmt:TextFormat = new TextFormat();
my_fmt.align = "right";
my_fmt.bold = true;
for (var i = 1; i<=4; i++) {
var nazev:String = "text"+i+"_txt";
this.createTextField(nazev,i,50,souradnice,200,20);
// another small problem... how can i create text area in my_mc?
// my_mc.createTextField(nazev,i,50,souradnice,200,20);
souradnice += 30;
this[nazev].text = pole[i-1];
trace("nazev: "+nazev);
// here it is OK
// this[nazev].setTextFormat(my_fmt);
}
var someListener:Object = new Object();
someListener.onSetFocus = function() {
var focus_sel:String = Selection.getFocus();
trace("focus_sel: "+focus_sel);
//... but here it is not working
this[focus_sel].setTextFormat(my_fmt);
};
Selection.addListener(someListener);
GetFocus And GetSelection
m looking for the code that clears an input text field once that text field has regained focus. For example, if I type Adobe Flash into an input text field, then move the mouse elsewhere (thereby losing focus for that text field), then put the I-beam cursor back into that same text field, what's the code that would clear the text field one it regains focus?
Also, what would be the code that removes each letter from a text field in reverse? For instance, if jay@bmws.com is in an input textfield, what would be the code to remove those characters/letters from the text field one by one, starting from the last character, one I move the mouse then put the I-beam cursor back into that text field?
Thanks for any assistance/fla.s
GetFocus And GetSelection
I'm looking for the code that clears an input text field once that text field has regained focus. For example, if I type Adobe Flash into an input text field, then move the mouse elsewhere (thereby losing focus for that text field), then put the I-beam cursor back into that same text field, what's the code that would clear the text field one it regains focus?
Also, what would be the code that removes each letter from a text field in reverse? For instance, if jay@bmws.com is in an input textfield, what would be the code to remove those characters/letters from the text field one by one, starting from the last character, one I move the mouse then put the I-beam cursor back into that text field?
Thanks for any assistance/fla.s
GetFocus() Properties ' Undefined ' HELP
Hi-
I'm having a lot of trouble with the following code:
Key.addListener(this);
this.onKeyDown = function () {
if (Key.isDown(Key.ENTER)) {
trace([Selection.getFocus()].whatever);
}
}
The problem is in: [Selection.getFocus()].whateverproperty
No matter what I put in, it returns 'undefined'.
If I have... trace([Selection.getFocus()]); ...it returns the path of the field.
Please help, as I am very stumped.
Thanks!
GetFocus, SetFocus Confusion
There are so many focus actions in regards to input text boxes that i can't distinguish which does what exactly.
The 'focus' action that i am looking for is when an input text box has text in it onload, the user clicks on the text box, then the text within it clears.
And if the user clicks outside of the textbox, the original text is back inside of the textbox.
I was thinking that it is getFocus, but i'm not sure.
Thanks for the help.
Selection GetFocus - In A Class
PHP Code:
if((Selection.getFocus() == "_level0.controller.xmlInput_txt") && (Key.isDown(Key.ENTER)))
....do something
the code above works well inside a class without any problems at all.
the issue i have is that the selection.getFocus wants a literal to check against - in this case it is "_level0.controller.xmlInput_txt" . If I use _level0.controller.xmlInput_txt it fails.
is there anyway i can pass it the textfield name or remove the literal as i dont like to use literals inside of my class?
thank you
Getting Input Boxes To ACTUALLY GetFocus
Code:
Selection.setFocus("1");
and give the user input an instance of "1" (minus the quotes). a simple this.getFocus won't work.....especially if you import from Captivate. For those of you who don't know, Captivate is a cross between PowerPoint and Swish...very annoying. The code Captivate gives you is fine as long as it goes nowhere NEAR Flash...once it does, things go to hell.
Problem Using Selection.getFocus Within MC's
On my Flash guestbook page, I have an input field with the variable "Name". When the page loads, that field contains the text "[name]". I would like the field to clear when the user clicks on it. I learned that this can be done with this script:
onClipEvent (enterFrame) {
if ((Selection.getFocus() == "_level0.Name") && (_root.Name ==
"[name]")) {
_root.Name = "";
}
}
My problem is, my guestbook page is not located on the root level. On the
main timeline, I have a Movie Clip called "Guestbook", and inside that Movie
Clip is another one called "EnterData", which is where the Name field is
located.
The script I'm using referrs to level 0 and the root level in places, so
it's not working. Can anyone tell me how to modify it given the location of
my fields?
Thanks.
Setfocus, Getfocus...I Dunno.
If anyone can help me with this it will be one of you,
I need to use something like a gotfocus event to tellTarget.
I have a flash (projector) animation that plays behind an application when the user exits his application window, but the animation uses alot of processing power so it must not play when the user's application is the focus window, only when the "projector"file is the focus window.
I can already stop the animation from playing when the user presses the (flash) button that launces his application, but there is no event that fires to the flash movie to tell it to start playing the animation again when he/she exits the program and the flash movie has focus.
Does that make any sense, I hope so.
Please if anyone has any ideas.
Thanks.
Textfield Getfocus Issue
Hi there
This is what I want to do:
I have an onscreen keyboard created in flash that when you touch the buttons inputs text into text fields - i.e. name, email address etc (this will be used on a kiosk touchscreen).
My issue is that I have three textfields on the stage and I need the keyboard buttons to recognise which textfield the user is in so it will input the text into the correct textfieds.
Basically what I'm wanting to say is "if the focus is on this field, type letters into it", but my scripting is not very advanced. Am I right in thinking I'll need a getFocus and an if Statement?
Any help would be much appreciated!
Selection.getFocus() Problem
I have a form that works perfectly, except for one thing.
The fields are being checked, and if the are not correctly filled in a message appears in them that they should be filled in, before sending..
It is something like this
Selection.setFocus("cname");
if (cname == null) {
cname = "Please fill in your company name";
action = "";
}
The form is inside a mc on the main timeline
Path is _root.wholesale.form
So I should be right that the path to the variable "cname" is:
_root.wholesale.form.cname right?
Then inside that form mc there is also a blank mc wich has the following code:
onClipEvent (mouseUp) {
if (Selection.getFocus() == "_root.wholesale.form.cname") {
_root.wholesale.form.cname = "";
}
Can somebody please check it for me, cuz I cant seem to get it working. The fields dont clear after the message....
I have looked through loads of posts on this subject, but I cant seem to figure out what it is that I am doing wrong?
Thnx
Tab Order In Duplicated MC's (GetFocus And SetFocus)
I have 5 duplicated movie clips, in a _level5 movie.
Each Movie Clip instance is named window0 - window4.
Nested in that movie clip, I have 4 dynamic input text fields that I want to set up to have a tab order. As we all know you use GetFocus() and SetFocus() to do the tab order. Because these are Duplicated MC's, and because the text fields are nested, I'd like to set up the path to the GetFocus() and SetFocus() to be dynamic, relative to their own path.
like this:
// this is just for two fields, and is set on an invisible button in the same clip as the text fields...
keyPress "<Tab>") {
if (Selection.getFocus() == "_level5["window" + x].form.mailform.Name") {
Selection.setFocus("_level5["window" + x].form.mailform.MailFrom");
} else if (Selection.getFocus() == "_level5["window" + x].form.mailform.MailFrom") {
Selection.setFocus("_level5["window" + x].form.mail.form.Subject");
}
It works when you have absolute paths, such as:
_level5.window0.form.mailform.Name etc..
Can anyone get the SetFocus() and GetFocus to work with dynamic paths?
thanks
Selection.getFocus() Not Working In MX/2004
The script below works fine in Flash5, but not in MX and MX 2004 - does anyone know how to clear a textfield when it is selected?
Old script:
if (Selection.getFocus() == "_root.name") {
_root.name = "";
}
Thank you,
:: serviator
Using A Button To GetFocus Of A Text Field
Hi i have a stage with a large number of text boxes on it. I want to press a button and it return the focus of the last text box which had focus. However it seems that whenever i try to use:
Btn.onRelease = function(){
focus = Selection.getFocus();
trace(focus)
}
it always returns null.
I think its because everytime you click the button it changes the focus to the button. I have searched this forum and the web but cant find any solution. Any help on solving the problem would be awesome.
Thanks
John
Text Input + GetFocus Problem
Hi,
I have a very big form, and i'm using the "TextInput" component, since my form is big, i prefer to make one condition which will test whatever the text input that have the current focus if it is empty or not before to put the cursor to next text input, and to display always the same message "Please enter a value".
very important, i use the enter key to go to next textinput, so i need to test each textinput one by one, and i cannot test them all together.
i made the follwoing code, but i am not able to make the test dynamically, i need each time to specify which textinput i am testing.
Also how to put the cursor in the next textinput which have the next TabIndex number for example dynamically, by using enter key instead of Tab key?
Thank you all.
here is the code:
Attach Code
Selection.setFocus("company_num");//
currentfield = Selection.getFocus();
msg_txt.text = currentfield
keyListener = new Object();
keyListener.onKeyUp = function () {
if ((Key.getCode() == Key.ENTER) && (currentfield.length == 0)) {
msg_txt.text = "Please enter a value";
} else {
if (Key.getCode() == Key.ENTER) {
Selection.setFocus("address_type");
msg_txt.text = "";
}
}
}
Key.addListener(keyListener);
Move Data Test (setFocus Or GetFocus)
Hello all -
I'm trying to conduct a little test before moving on to something way more complex...basically I have an input field called 'cardIDText' on Frame 1. On Frame 2 I have a dynamic text feild with the instance name 'playerName'.
What I'm trying to accomplish is this:
1. At Frame 1, type in '12345' into 'cardIDText'
2. Hit the ENTER key
3. The timeline advances to Frame 2
4. 'playerName' becomes magically populated with the numbers '12345'
5. I need to be able to do this globally so that the 'playerName' data can be altered from anywhere in the movie (I already have calls on it to change its properties)
In the Flash help files I found this:
if (focusManager.getFocus() == myInputText)
{
focusManager.setFocus(myOKButton);
}
and fiddled with it to no avail...can anyone help? THanks in advance!
Input Text And SetSelection- Cant Select On GetFocus?
Im trying to select (highlight) all the text in a textfield which I have set as input text. I want the contents of the box to be highlighted when the box receieves focus.... I can highlight the content via code on the main timeline but i cant highlight it from within the onSetFocus handler.... heres what ive tried:
critScore.onSetFocus = function()
{
trace("got focus");
Selection.setFocus(this);
Selection.setSelection(0, this.text.length);
}
ideas?
Wtf? Text Field And GetFocus Issues -- Code Inside
Below is a script I've been struggling with for a little while. I have a set of text fields, one of them is called 'letter' -- as you can see, you're supposed to enter a variation of $50,000.00 into the text field...
the only problem is that the selection is not recognizing the letter text field as it should. When traced selection returns [object object] instead of letter.
Any ideas what's wrong?
Code:
onClipEvent (mouseUp) {
var selected = Selection.getFocus();
if (selected != _root.letter) {
if ((letter != "$50,000.00") and (letter != "$50,000") and (letter != "50,000.00") and (letter != "50,000") and (letter != "50000") and (letter != "$50000.00") and (letter != "$50000") and (letter != "50000.00")) {
trace (selection);
gotoAndStop (15);
} else {
gotoAndStop (1);
}
}
}
Selection.setFocus Selection.getFocus Inputting From Mc
i am attaching a number of _mc (my_mc) with a for loop. Inside each my_mc is an input textfield (my_txt)
I want to click on my_mc.my_txt and select the textfield .the following code allow this and i can enter text from the keyboard however I want to add text from a _mc keybooard on screen (here called myBtn_mc).
As soon as I click on myBtn_mc of course I lose focus ... i have tried to use a variable (select) to keep scope&focus ... I keep focus but can not add text via screen _mc
many thanks Neil
Problem With OnRelease For MovieClip Inside Draggable MovieClip [Flash Pro 8]
I have a movie clip, circle_mc, and in it is embed another movie clip, point_mc. I made the circle draggable with this:
Code:
circle_mc.onPress = function() {
startDrag(this);
};
circle_mc.onRelease = function() {
stopDrag();
};
and that part works fine.
I also want to be able to click on point_mc which is within the circle_mc movie clip. So, I added this:
Code:
circle_mc.point_mc.onRelease = function() {
trace("click was successful");
}
This does not work, and I'm pretty sure it is BECAUSE its parent clip is draggable and therefore has its own onRelease function. (If I comment-out the drag code, then the other code works as intended.)
Is there any way to do this or am I out of luck?
Movieclip Inside Movieclip In Flash MX
hmmmmm...........
how do you tell a movieclip inside a movieclip to do something? how come the old _root. code is not working anymore in flash MX? can someone help me out here? thx a whole lot
Flash.display.MovieClip.MovieClip()
In attempting to transition from AS2 to AS3 I'm having some difficulty finding detailed information about the change from duplicateMovieClip() (AS2) to flash.display.MovieClip.MovieClip() (AS3). I can't find anything helpful in the documentation. How is flash.display.MovieClip.MovieClip() used to 'duplicateMovieClip(s)' in AS3?
Elastic Movieclip --> As Flash 5 Ok, As Flash 6 Strange
i have downloaded a movie in the movie section...
http://www.flashkit.com/movies/Scrip...5546/index.php
i tried it out in flash 5 and all is well
but if i export it as flash 6 strange things happens...
what´s going on here...? would be interesting for me...
thx
#1009 Error Movieclip Inside Movieclip Changing The Alpha Property
Problem:
I'm getting this "TypeError: Error #1009: Cannot access a property or method of a null object reference."
What's happening in the flash file is that I've got a movieclip inside a movieclip and when you roll over one of the movieclips the alpha setting for the movieclip inside the initial movieclip is set to 1, then it transitions out back to 0 over a period of time.
var myTween:Tween = new Tween(event.target.parent.ripple_mc, "alpha", Strong.easeOut, 0, 100, 24, false);
It seems to be random but eventually after rolling over the several movieclips on the stage the error comes up. Sometimes the alpha setting stops working and will continue to be visible even though it should have stopped and be invisible after 24 frames.
Would love some help on this.
Cheers
#1009 Error Movieclip Inside Movieclip Changing The Alpha Property
Problem:
I'm getting this "TypeError: Error #1009: Cannot access a property or method of a null object reference."
What's happening in the flash file is that I've got a movieclip inside a movieclip and when you roll over one of the movieclips the alpha setting for the movieclip inside the initial movieclip is set to 1, then it transitions out back to 0 over a period of time.
var myTween:Tween = new Tween(event.target.parent.ripple_mc, "alpha", Strong.easeOut, 0, 100, 24, false);
It seems to be random but eventually after rolling over the several movieclips on the stage the error comes up. Sometimes the alpha setting stops working and will continue to be visible even though it should have stopped and be invisible after 24 frames.
Would love some help on this.
Cheers,
Sarge
Control A Nested MovieClip From A Button Component Inside A Seperate MovieClip.
I am a beginner in using Flash and Action Scripting.
This is the Scenerio:
I want to control a movieclip that is inside of another movie clip.
I control it from a button component that is inside of a seperate movie clip.
test = button component instance name
test1 = function
test2 = Movieclip instance name
test3 = Movieclip instance name
testbutton = movieclip name where button component is located
I am able to control a movieclip on the main timeline with the following AS 3.0:
test.addEventListener (MouseEvent.CLICK, test1);
function test1(event:MouseEvent):void
{
event.target.root.test2.gotoAndPlay(2);
}
I want to control a movieclip inside MovieClip1.
I tried this:
test.addEventListener (MouseEvent.CLICK, test1);
function test1(event:MouseEvent):void
{
event.target.root.test2.test3.gotoAndPlay(2);
}
The movie loaded fine when I tested but got this error when I pressed the button:
TypeError: Error #1010: A term is undefined and has no properties.
at Untitled_fla::testbutton_26/test1().
Please help!!!!!!!!!
MovieClip.onRelease = MovieCLip.Protoype Function Fails To Execute Properly
Dear all,
I created a simpe function:
MovieClip.prototype.hiMe = function(me, theRest)
{
//declare the format colors white and grey
formatMe = new TextFormat();
formatMe.color = Colors[0];
formatMe.font = "Adventure Subtitles";
formatTheRest = new TextFormat();
formatTheRest.color = Colors[1];
formatTheRest.font = "Adventure Subtitles";
// assign grey to theRest
for (i =0 ; i < theRest.length; i++)
{
theRest[i].tfield.setTextFormat(formatTheRest);
}
// make the me white
me.tfield.setTextFormat(formatMe);
}
when I call it (bar[0] is an array of objects)
bar[0].invar.onRelease = hiMe(bar[0],bar);
it executes on load regardless of the onRelease eventHandler and the ownards it does not execute when exciting the event.
does somebody know why this may be?
Cheers
DDT
MovieClip.onRelease = MovieCLip.Protoype Function Fails To Execute Properly
Dear all,
I created a simpe function:
MovieClip.prototype.hiMe = function(me, theRest)
{
//declare the format colors white and grey
formatMe = new TextFormat();
formatMe.color = Colors[0];
formatMe.font = "Adventure Subtitles";
formatTheRest = new TextFormat();
formatTheRest.color = Colors[1];
formatTheRest.font = "Adventure Subtitles";
// assign grey to theRest
for (i =0 ; i < theRest.length; i++)
{
theRest[i].tfield.setTextFormat(formatTheRest);
}
// make the me white
me.tfield.setTextFormat(formatMe);
}
when I call it (bar[0] is an array of objects)
bar[0].invar.onRelease = hiMe(bar[0],bar);
it executes on load regardless of the onRelease eventHandler and the ownards it does not execute when exciting the event.
does somebody know why this may be?
Cheers
DDT
#1009 Error Movieclip Inside Movieclip Changing The Alpha Property
Problem:
I'm getting this "TypeError: Error #1009: Cannot access a property or method of a null object reference."
What's happening in the flash file is that I've got a movieclip inside a movieclip and when you roll over one of the movieclips the alpha setting for the movieclip inside the initial movieclip is set to 1, then it transitions out back to 0 over a period of time.
var myTween:Tween = new Tween(event.target.parent.ripple_mc, "alpha", Strong.easeOut, 0, 100, 24, false);
It seems to be random but eventually after rolling over the several movieclips on the stage the error comes up. Sometimes the alpha setting stops working and will continue to be visible even though it should have stopped and be invisible after 24 frames.
Would love some help on this.
Cheers,
User Input Creates MovieClip Made Of MovieClip Symbols
Hello. I need some help either with my situation or with the search terms I'm using to try to find an answer.
I am using Flash MX Pro 2004.
I have drawn letters A-Z in Flash in two different styles (for example one that is furry and another that looks like metal). I would like users to select a text style (furry or metal) and enter text via text input field. When they have pressed an Enter button I would like the word to appear made up of the drawn symbols that I created.
I don't want to make an actual font. Any ideas on search terms to find the sort of thing I am looking for? Here's some that I've tried already:
convert text to symbols -- I get tons of results talking about putting textfields in symbols.
user input to symbols -- almost same results as above
custom fonts using symbols -- I get results talking about how to embed fonts and making text bold, italic, etc. Also not what I'm after.
All help is appreciated. Thanks in advance.
Scott
|