Copy link to clipboard
Copied
I want to be able to make the relevent ErMsg to alpha 100 if infoDats0 or infoDats1 text length is <=1. Below is my code and can't get it to work?
var chkEk:Array = [chkE0, chkE1]
var theTFa = new Array(infoDats0, infoDats1)
var ErMsg = new Array(Field0, Field1) // alpha is set to 0 at the start
function findIndexF(tf:TextField):Number{
for(var i:Number=0;i<theTFa.length;i++){
if(tf==theTFa){
return i;
}
}
};
goUp_btn.onRelease = function() {
var chkE0 = infoDats0.text.split(' ').join('');
var chkE1 = infoDats1.text.split(' ').join('');
for(i=0; i<theTFa.length; i++){
if (chkE0.length>1 && chkE1.length>1){
//doSome
} else {
if (chkEk.length<=1){
ErMsg[findIndexF(i)]._alpha= 100; //not working
}
}
}
};
click your button and opy and paste the trace output using
goUp_btn.onRelease = function() {
var chkE0 = infoDats0.text.split(' ').join('');
var chkE1 = infoDats1.text.split(' ').join('');
trace(chkE0+" : "+chkE1);
trace(chkEk);
for(i=0; i<theTFa.length; i++){
if (chkE0.length>1 && chkE1.length>1){
//doSome
} else {
if (chkEk.length<=1){
ErMsg[findIndexF(i)].
...Copy link to clipboard
Copied
findIndexF is expecting a textfield and you're passing a number. that's not going to work.
Copy link to clipboard
Copied
How should I approach in getting this fixed? is there a way to relate theTFa to chkEk ?
Copy link to clipboard
Copied
findIndexF(ErMsg) makes more sense but in the context of your code it looks like you might want to use:
ErMsg._alpha=100;
Copy link to clipboard
Copied
Thanks kglad. I tried both;
findIndexF(ErMsg) - did not work'.
ErMsg - turned everything (ErMsg) to 100 alpha.
Copy link to clipboard
Copied
what do chkE0 and chkE1 look like?
Copy link to clipboard
Copied
variables. I'm using those variables to make sure there's some text in theTFa at the time its being pressed.
Copy link to clipboard
Copied
i know they're variables. what are their values?
Copy link to clipboard
Copied
infoDats0 text field contains the users name and infoDats1 contains postcode. I'm basically trying to avoid those 2 text fields being empty when goUP_btn is pressed.
Copy link to clipboard
Copied
click your button and opy and paste the trace output using
goUp_btn.onRelease = function() {
var chkE0 = infoDats0.text.split(' ').join('');
var chkE1 = infoDats1.text.split(' ').join('');
trace(chkE0+" : "+chkE1);
trace(chkEk);
for(i=0; i<theTFa.length; i++){
if (chkE0.length>1 && chkE1.length>1){
//doSome
} else {
if (chkEk.length<=1){
ErMsg[findIndexF(i)]._alpha= 100; //not working
}
}
}
};
Copy link to clipboard
Copied
thank YOU kglad.
chkEk was undefined. Got it fixed!
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now