Let's say the input string (assuming it is passed as a string?) is "my blue dog". Then your function will run through the loop 5 times (should that be 4?). First it looks for "red", which isn't found, so mColor2 is set to "not known". Then it looks for "blue", which is found, so mColor2 is set to "blue". Then it looks for "yellow", and mColor2 is set back to "not known". Same for "green", and then I don't know what it will look for when i is 4.
In any case, you don't want to reset mColor2 to "not known", just get rid of your Else.
Have you decided what to do if the input string contains more than one of the strings you're looking for? Do you want to exit as soon as you find "red", or continue and remember the last one found?