Please follow http://flash.bigresource.com/ActionScript-2-0-Check-which-variable-has-a-certain-value-then-return-variables-name--HLrlei14g.html.