First of all, this has two conditions for working. The first being, this only works if the candy is just a random flavor from those already in production, as in, the candy isn't a mysterious flavor that hasn't been named nor is available in any named fashion. Pretty sure airheads are like that, the white mystery flavor, or perhaps they made it like that precisely so that the flavor could not be guessed using this method. I don't like airheads so I'm not sure about the mystery flavor. The second condition is that the ingredients are on the individual packages of the mystery flavor.
Okay, now that the formalities are out of the way, the way to do it is very simple. Take the package of the mystery flavor and look into the ingredients, you know, that long list of things that you can't even pronounce nor figure out what they're for. Now candy, for the most part, has dye in it, do you see what I'm getting at? The individually wrapped mystery flavors have to have the ingredients used in that package, thus, whatever dye was used is the same dye used in the nonmystery named candies.
What's the use of this knowledge? Easy, two uses, amaze your friends and get the candy flavor you want if it's out of stock. Pick up the mystery flavor, compare it to the ones you don't want, and just find the one that uses the dyes for the color of candy you like. Personally I really like blue raspberry flavors, but my ring pop container was out, so I picked up a mystery, read the ingredients and found blue dye. Not many other flavors use blue dyes.
There are some down sides like watermelon/cherry/strawberry/raspberry for the most part tend to be red colors, tho watermelon is sometimes green. So in that case, you gotta figure out if there's subtly different dyes used for these flavors or perhaps a different ingredient that you can rely on instead.
So yeah, 9/10 times, you got this in the bag, 10/10 if you figure out the differences between the similar candies.