Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-11-2009, 11:26 AM   #1
nvidia123
Registered User
 
Join Date: Nov 2007
Posts: 39
Default General Query: User Input

Hi,

i've been reading Learning Actionscript 3.0 book for some time now and have read about 6 chapters give or take, and up and until now i've not seen examplse of a user inputing a value like a number which is then added to another number and outputed, not yet anyway.

Are there any special variables that i can use for user inputs that i can run using FlashDevelop beacuse i know that you can do this in Java, but i've not seen any example in my book that does this nature, yet. Or would this require me to develop some type of form?

Could somebody kindly show me a simple example of this please.

Thanks
nvidia123 is offline   Reply With Quote
Old 11-11-2009, 02:12 PM   #2
maskedMan
Obfuscated Coder
 
maskedMan's Avatar
 
Join Date: Apr 2008
Posts: 1,571
Default

If by 'user inputs' you mean text, you'd place text fields in your fla, set them as Input Text in their dropdown box (as opposed to Static or Dyamic Texts), give them instance names.

Users can input text into these boxes, which you can then parse in functions. Whether you want the application to parse this data on every keystroke, or on a mouseclick is up to you, and requires you to learn more about MouseEvent and KeyboardEvent objects, and how to listen for them.
__________________
http://www.scriptocalypse.com - It's not the end of the world. It's just Actionscript!

man.mask = mask_mc;
maskedMan is offline   Reply With Quote
Old 11-11-2009, 03:34 PM   #3
Shaedo
Registered User
 
Join Date: Mar 2009
Posts: 17
Default

For example:
ActionScript Code:
var t:TextField = new TextField(); t.x = t.y =30; t.width = 90; t.height = 20; t.border=true; t.type = TextFieldType.INPUT; t.restrict='0-9'; addChild(t); t.addEventListener(Event.CHANGE,tt,false,0,true); function tt(e:Event):void {     if(t.text.length>5)     {         trace(t.text);         t.text='';     } }

for more info:
http://help.adobe.com/en_US/AS3LCR/F...ld.html#border

Luck,
S
Shaedo 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


All times are GMT. The time now is 09:16 PM.

///
Follow actionscriptorg on Twitter

 


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