Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: RE: FLASH: Text entry focus
From: Kenneth.Austin
Date: Wed, 8 Mar 2000 11:08:42 GMT

Sorry to those of you (Jason especially) that have been inquiring about the
whole text field thing, I've been slammed lately. This is a long one, if you
don't care about text fields delete away.

Basically, there is a way to fake targeting a text box, it's not perfect,
and it's a pain to do, probably not worth it if you just have a few text
fields. Just wait for Flash 5 if it's not that important. Also, I didn't
personally write this, a colleague of mine, Chris Vodopia did, have to give
credit where credit is due. I just helped with the concept and some
finishing touches.

Anyway, here it goes

Start with an editable text field, name it something like "text". Disable
Editing and Disable Selection on the text field.
Add a layer named actions, and add about 10 frames or so to the movie. If
the text box is going to be reused, on the first frame set the variable
"text" to "" to clear it. On the next frame, add a blank keyframe and label
it "loop". Set a variable "cursor" to a "|" or whatever you want the cursor
to be. Set the variable "text" to "text&cursor". This will append a pipe to
the end of the text string. A few frames later, set another blank keyframe.
Here set another variable "length" to "Length(text)". Using and If statement
and the Substring action check whether there's a cursor on the end of
"text", and if there is, set "text" to the length of "text" minus one. This
will take the pipe off if there's one there. A few frames later, set another
keyframe with an action to go to and play frame label "loop".

Now you have a looping movie that adds and takes off a cursor to a text
field. You can adjust the timing of the blink by adjusting the number of
frames between the keyframes. Next the hairy part.

Set up a button off stage or invisible. For it's actions, you have to map an
action to each key on the keyboard. For each key, for example "a", say on
keypress "a" check the last character in "text", and if it's not a "|" set
variable "text" to "text"&a, else take off the last character and then add
the a. For the Backspace key, if the last character is not a "|" take of one
from the length, if it is take off two. Remember you have to do both
uppercase and lowercase if you want both to work. Also, if you want to check
the variable like in a quiz or something remember to check if there's a
cursor and take it off before you check it.

Mapping each key sucks, hopefully you have an intern (hehe).

It's not perfect, you can't select the text with the mouse, and the arrow
keys don't work (you can do that too but we don't feel like doing it).

Sorry I can't post the .fla, I didn't write it and it's owned by
KnowledgeNet. I hope that wasn't too confusing, if you have any questions
let me know, I'll do the best I can to get help out.

good luck,


Kenneth Austin
Hands On Labs

KnowledgeNet
14624 N Scottsdale Rd, Suite 300
Scottsdale AZ 85254
Email: <Kenneth [dot] Austinatknowledgenet [dot] com>
Web: <www.knowledgenet.com>


-----Original Message-----
From: owneratchinwag [dot] com [owneratchinwag [dot] com]On">mailto:owneratchinwag [dot] com]On Behalf Of Paul
Gleason
Sent: Tuesday, March 07, 2000 8:31 AM
To: 'flasheratchinwag [dot] com'
Subject: FLASH: Text entry focus


I 'm having a problem giving focus to a transparent text entry field. Is
there a way to give a specific text field focus so that it is ready to
accept keystrokes, other than user clicking on it?

tia,

- paul


flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and The Flash Film Festival
"The World�s Premier Flash Solutions Conference and Expo"
March 27-29, Nob Hill Masonic Center, San Francisco, California

-Register before Feb 25 and save $200!!-- www.flashforward2000.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]