There is no reason a person can't text the opposite sex as friends, but, if it turns into flirting or even making a date with that person then it is cheating on your spouse whether you have sexual contact or not. An affair is when you yearn for something; get together by sneaking around behind your spouse's back and it leads to a sexual relationship. If there is nothing going on then texting the opposite sex shouldn't be a secret and you should be able to speak to your spouse about it if you feel the need and if you don't feel this way you are following a very risky road and you are kidding yourself that you want more out of the person you are texting.