Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-13-2009, 04:50 PM   #1
snakey112
Registered User
 
Join Date: Nov 2009
Posts: 46
Default Validation

Ok just re-doing this thread. Ok I have 6 input text field on the user interface. In each one I want the user to type in 6 different numbers between 1 and 49. Once they've done this and they click the enter button. If they have entered two or more numbers the same e.g '12,41,12,34,21,33' then I want a message to appear on the user interface saying some sort of error message. and the same if they submit a number not within the stated margins (1-49).

Could you please tell me what code I would need to add to get the effect I want!

Thanx in advance.


submitButton.addEventListener(MouseEvent.CLICK, submitInfo);

function submitInfo(event) {

var myArray_array:Array = new Array ();

myArray_array.push(Number(textInput1_txt.text));
myArray_array.push(Number(textInput2_txt.text));
myArray_array.push(Number(textInput3_txt.text));
myArray_array.push(Number(textInput4_txt.text));
myArray_array.push(Number(textInput5_txt.text));
myArray_array.push(Number(textInput6_txt.text));
}
snakey112 is offline   Reply With Quote
Old 11-13-2009, 04:53 PM   #2
dimpiax
Senior Member
 
dimpiax's Avatar
 
Join Date: Mar 2008
Location: Ukraine, Kiev
Posts: 113
Send a message via Skype™ to dimpiax
Default

smt like this:
ActionScript Code:
var _validationArr : Array = new Array(6); _submitButton.addEventListener(MouseEvent.CLICK, submitInfoListener); function submitInfoListener(event : MouseEvent) : void {     var i : uint = 0;     var length : uint = _textFieldsContainer.numChildren;        while(i < length) {         _validationArr[i] = this.checkTextFieldValue((_textFieldsContainer.getChildAt(i++) as TextField).text);     } } function checkTextFieldValue(str : String) : Boolean {     if(str && str.length <= 2) return true;     return false; }

and by the way, don't forget to set restrict of num characters to these textfields.
Enjoy it

Last edited by dimpiax; 11-13-2009 at 05:03 PM.
dimpiax is offline   Reply With Quote
Old 11-13-2009, 05:08 PM   #3
snakey112
Registered User
 
Join Date: Nov 2009
Posts: 46
Default

Thanks Dimpiax, but I have 6 different input text boxes, what do I put as their instances names?
snakey112 is offline   Reply With Quote
Old 11-15-2009, 05:16 PM   #4
dimpiax
Senior Member
 
dimpiax's Avatar
 
Join Date: Mar 2008
Location: Ukraine, Kiev
Posts: 113
Send a message via Skype™ to dimpiax
Default

in this case, their names dont influence at result.
You put them in defined container(DisplayObjectContainer). And u have to read them in cycle, like i've written.
dimpiax is offline   Reply With Quote
Old 11-15-2009, 05:20 PM   #5
TucoRamirez
Registered User
 
Join Date: Nov 2009
Posts: 24
Default

пардон за оффтоп....
шалом dimpiax!
TucoRamirez is offline   Reply With Quote
Old 11-15-2009, 05:22 PM   #6
dimpiax
Senior Member
 
dimpiax's Avatar
 
Join Date: Mar 2008
Location: Ukraine, Kiev
Posts: 113
Send a message via Skype™ to dimpiax
Default

[offtop]
привет)
мы знакомы?
[/offtop]
dimpiax is offline   Reply With Quote
Old 11-15-2009, 05:31 PM   #7
TucoRamirez
Registered User
 
Join Date: Nov 2009
Posts: 24
Default

Нет, просто увидел у тебя слово Украина в локейшн. Я сам армянин, но мои родители с Украины.
Ты флешем давно занимаешься? по работе или как хобби? я сейчас проект готовлю, ищу людей программирующих во флэш.
TucoRamirez is offline   Reply With Quote
Old 11-15-2009, 05:35 PM   #8
TucoRamirez
Registered User
 
Join Date: Nov 2009
Posts: 24
Default

да, если не сложно глянь вот эту тему http://www.actionscript.org/forums/s....php3?t=222781

там суть в том, что даны два movie клипа. один наложен на другой. как можно их программно поменять местами? там дали ответ, но, не то, что хотелось бы. в ASP есть такая штука Z-index, например одному рисунку поставил его 100, другому 200 и выше будет тот, у которого 200. может во флэш есть что то такое? пока не нашёл.
TucoRamirez is offline   Reply With Quote
Old 11-15-2009, 05:56 PM   #9
dimpiax
Senior Member
 
dimpiax's Avatar
 
Join Date: Mar 2008
Location: Ukraine, Kiev
Posts: 113
Send a message via Skype™ to dimpiax
Default

напиши мне в аську: 226-430-414
dimpiax 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 07:48 AM.

///
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.