Making a ground? Collision help!

im making a 2d game with platforms and walls and floors and such, i’ve got most of the physics i need. gravity, speed, ect. But when he is supposed to stop after "hitting the ground he just goes straight thru. The ground he should stop at is a mc called bg and inside is a mc called platform. what am i doing wrong?

onClipEvent(enterFrame){
    //Keeps Character from going thru the floor, roof & walls
    if(this.hitTest(_root.bg.platform)==true
        gravity = 0;
}