11-13-2009, 04:50 PM
|
#1
|
|
Registered User
Join Date: Nov 2009
Posts: 46
|
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));
}
|
|
|
11-13-2009, 04:53 PM
|
#2
|
|
Senior Member
Join Date: Mar 2008
Location: Ukraine, Kiev
Posts: 113
|
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.
|
|
|
11-13-2009, 05:08 PM
|
#3
|
|
Registered User
Join Date: Nov 2009
Posts: 46
|
Thanks Dimpiax, but I have 6 different input text boxes, what do I put as their instances names?
|
|
|
11-15-2009, 05:16 PM
|
#4
|
|
Senior Member
Join Date: Mar 2008
Location: Ukraine, Kiev
Posts: 113
|
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.
|
|
|
11-15-2009, 05:20 PM
|
#5
|
|
Registered User
Join Date: Nov 2009
Posts: 24
|
пардон за оффтоп....
шалом dimpiax!
|
|
|
11-15-2009, 05:22 PM
|
#6
|
|
Senior Member
Join Date: Mar 2008
Location: Ukraine, Kiev
Posts: 113
|
[offtop]
привет)
мы знакомы?
[/offtop]
|
|
|
11-15-2009, 05:31 PM
|
#7
|
|
Registered User
Join Date: Nov 2009
Posts: 24
|
Нет, просто увидел у тебя слово Украина в локейшн. Я сам армянин, но мои родители с Украины.
Ты флешем давно занимаешься? по работе или как хобби? я сейчас проект готовлю, ищу людей программирующих во флэш.
|
|
|
11-15-2009, 05:35 PM
|
#8
|
|
Registered User
Join Date: Nov 2009
Posts: 24
|
да, если не сложно глянь вот эту тему http://www.actionscript.org/forums/s....php3?t=222781
там суть в том, что даны два movie клипа. один наложен на другой. как можно их программно поменять местами? там дали ответ, но, не то, что хотелось бы. в ASP есть такая штука Z-index, например одному рисунку поставил его 100, другому 200 и выше будет тот, у которого 200. может во флэш есть что то такое? пока не нашёл.
|
|
|
11-15-2009, 05:56 PM
|
#9
|
|
Senior Member
Join Date: Mar 2008
Location: Ukraine, Kiev
Posts: 113
|
напиши мне в аську: 226-430-414
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 07:20 AM.
///
|
|