Problems using "Selection.getFocus()” method"

[font=Times New Roman]I’ve been having a bit of trouble using the “Selection Object”[/font]

[font=Times New Roman] [/font]

[font=Times New Roman]What I don’t get is when using the “Selection.getFocus()” method, unless you create a movie with a lot of frames, say 60, the user will not have time to select a field for the method to report back on.[/font]

[font=Times New Roman] [/font]

[font=Times New Roman]I have tried the following script in the first frame[/font]

[font=Times New Roman] [/font]

[font=Times New Roman]stop();[/font]

[font=Times New Roman]eval(Selection.getFocus()).text=“Goat”;[/font]

[font=Times New Roman] [/font]

[font=Times New Roman]but because when the movie started playing no field had focus & Flash reports this back –nothing happens when I click into a field.[/font]

[font=Times New Roman] [/font]

[font=Times New Roman]Basically what I’m after is a way to stall Flash until a field is selected.[/font]

[font=Times New Roman] [/font]

[font=‘Times New Roman’]I have got round this by using the “onSetFocus” Listener, but can’t see the point of the other methods if flash will not give them time to trigger?[/font]

In this case you should indeed use the onSetFocus handler, since you want to stall the movie until the user selects the textfield (which means you have to constantly check because you don’t know if it will take 1 frame, 5 frames, or even 100 fames to happen)
The Selection.getFocus() method applied on a frame will execute only once, when that frame is played. So if the user selects a textfield after that frame has been played, you won’t get the desired result.

Thank you very much claudio for such a concise & helpful reply

You’re welcome :slight_smile: