Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Flash In Action > Widgets

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-27-2005, 12:59 AM   #1
brendanww
AS.Org Newbie
 
Join Date: Feb 2005
Posts: 78
Default New way to make text box with actionscript

I've been familiarizing myself with some functions that will be useful for new chat features, and I made a different type of textbox in flash:

PHP Code:
createEmptyMovieClip("fudge"0);
fudge.createTextField("dynamictext"getNextHighestDepth(), 00300300);
fudge.dynamictext.border true;
fudge.dynamictext.html true;
keyListener = new Object();
0;
keyListener.onKeyDown = function() {
    
lastkeycode Key.getCode();
    if (
lastkeycode == 8) {
        if (
k>0) {
            
k--;
            
curtext fudge.dynamictext.text;
            
newtext curtext.substring(0k);
            
fudge.dynamictext.text newtext;
        }
    } else {
        
k++;
        
fudge.dynamictext.text _root.fudge.dynamictext.text+chr(Key.getAscii());
    }
};
Key.addListener(keyListener); 
brendanww is offline   Reply With Quote
Old 12-08-2005, 05:03 PM   #2
bleepbloop
Member
 
Join Date: Jul 2004
Location: brighton, uk
Posts: 73
Default

what does it do? Which key has a value of 8?
bleepbloop is offline   Reply With Quote
Old 12-20-2005, 10:16 AM   #3
Headshotz
TEAM INTERNET
 
Headshotz's Avatar
 
Join Date: Jul 2005
Location: Batcave
Posts: 2,759
Send a message via MSN to Headshotz
Default

Pretty cool , you used php formatting on your code though, AS:

ActionScript Code:
createEmptyMovieClip("fudge", 0); fudge.createTextField("dynamictext", getNextHighestDepth(), 0, 0, 300, 300); fudge.dynamictext.border = true; fudge.dynamictext.html = true; keyListener = new Object(); k = 0; keyListener.onKeyDown = function() {     lastkeycode = Key.getCode();     if (lastkeycode == 8) {         if (k>0) {             k--;             curtext = fudge.dynamictext.text;             newtext = curtext.substring(0, k);             fudge.dynamictext.text = newtext;         }     } else {         k++;         fudge.dynamictext.text = _root.fudge.dynamictext.text+chr(Key.getAscii());     } }; Key.addListener(keyListener);
__________________
The author of windows file copy dialogue visits some friends:
"I'm just outside of town so I should be there in about 15 minutes"
"Actually it's looking more like 6 days"
"No, wait, 30 seconds"

Last edited by Headshotz; 12-20-2005 at 10:19 AM..
Headshotz is offline   Reply With Quote
Old 02-06-2006, 09:04 AM   #4
PsychoSpike
Registered User
 
PsychoSpike's Avatar
 
Join Date: May 2004
Location: Aalter, Belgium
Posts: 73
Default

that is a way to make text, but not the best way, (of course you know how)

i was tinkering with key. events too and found that there is no way to use shift with non letters (i mean uppercase and lowercase letter can work) but not for for example "?" which is shift + "," on my keyboard...

any ideas?
PsychoSpike is offline   Reply With Quote
Old 02-10-2006, 03:05 PM   #5
sophistikat
Game On
 
sophistikat's Avatar
 
Join Date: Mar 2005
Location: Barrie, ON
Posts: 2,519
Default

http://livedocs.macromedia.com/flash...=00002294.html
ActionScript Code:
var keyListener:Object = new Object(); keyListener.onKeyDown = function() {     trace("The ASCII code for the last key typed is: "+Key.getAscii()); }; Key.addListener(keyListener);
1 = 49
Shift = 0
Shift + 1 = 33
sophistikat is offline   Reply With Quote
Old 02-11-2006, 06:11 AM   #6
Headshotz
TEAM INTERNET
 
Headshotz's Avatar
 
Join Date: Jul 2005
Location: Batcave
Posts: 2,759
Send a message via MSN to Headshotz
Default

Thanks for that link
__________________
The author of windows file copy dialogue visits some friends:
"I'm just outside of town so I should be there in about 15 minutes"
"Actually it's looking more like 6 days"
"No, wait, 30 seconds"
Headshotz is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i make a text field expand to fit scripted text? ds.pixeled ActionScript 2.0 4 09-21-2005 06:25 PM
XML/ActionScript help pleeeeeeese....... witchking ActionScript 2.0 3 01-21-2005 07:42 AM
Help with HTML in dynamic text field... puckett_jw ActionScript 1.0 (and below) 8 08-04-2003 01:58 AM
text in MC how to really undefine onPress... jcgodart ActionScript 1.0 (and below) 5 06-20-2003 09:20 AM
using function to actionscript text movement dkode ActionScript 1.0 (and below) 2 02-19-2002 07:39 PM


All times are GMT. The time now is 03:12 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.