Collision detection based on color

So I was thinking of ways to easily implement different terrain collision detection in my little beat’emup style engine, and I came up with a vague idea about color coding the movieclip that represents the “ground” so that I could check the value of a certain pixel and depending on what color it was, I could get my hero to swim/slow down/whatever.

I don’t see why it wouldn’t work, but the only problem is I have no idea how return the pixels color value.

Any ideas?