Skip to main content
Inspiring
September 27, 2013
Answered

ErMsg[findIndexF(i)]._alpha= 100;

  • September 27, 2013
  • 1 reply
  • 1675 views

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

                              }

                    }

          }

};

This topic has been closed for replies.
Correct answer kglad

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.


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

                              }

                    }

          }

};

1 reply

kglad
Community Expert
September 27, 2013

findIndexF is expecting a textfield and you're passing a number.  that's not going to work.

Inspiring
September 27, 2013

How should I approach in getting this fixed? is there a way to relate theTFa to chkEk ?

kglad
Community Expert
September 27, 2013

Thanks kglad. I tried both;

findIndexF(ErMsg)  - did not work'.

ErMsg - turned everything (ErMsg) to 100 alpha.


what do chkE0 and chkE1 look like?