Collision detection?

I would like to be able to make objects and landscape and whatever and just have the character not pass through them. I’ve done a bit of looking and everything is tile based. Is there any way to do it without using tiles? You know: Just setting up your landscape, calling each instance of ground “ground” and having your character not fall through? Here is my code.

hero.gotoAndStop('still');

var Key:KeyObject = new KeyObject(stage);

var dy:Number=0;
var gravity:Number=1;
var canjump:Boolean=false;
var canwalk:Boolean=true;
var speed:Number=0;
var herodir:Number=0;
var friction:Number=.9;

stage.addEventListener(Event.ENTER_FRAME,onenter);
var sw:uint = stage.stageWidth;
function onenter(e:Event):void{
    
    
    
    //Gravity
    dy+=gravity;
    if(hero.y>200){
        dy=0;
        canjump=true;
        canwalk=true;
    }
    
    if(Key.isDown(Key.UP) && canjump){
        dy=-10;
        canjump=false;
        canwalk=false;
    }
    
    hero.y+=dy;
    
    
    // Loop-Around
    if(hero.x>sw){
        hero.x = 1;
    }
    if(hero.x<0){
        hero.x = sw-1
    }
    
    //Movement
    herodir=0;
    if(Key.isDown(Key.LEFT)){herodir=1};
    if(Key.isDown(Key.RIGHT)){herodir=2};
    
    switch(herodir)
    {
        case 1: 
        speed-=4;
        hero.scaleX=1;
        if(canwalk){hero.gotoAndStop('walking');}else{hero.gotoAndStop('still');}
        break; 
        
        case 2: 
        speed+=4;
        hero.scaleX=-1;
        if(canwalk){hero.gotoAndStop('walking');}else{hero.gotoAndStop('still');}
        break;
        
        default:
        hero.gotoAndStop('still');
    }
    
    if(speed>20){speed=20;}
    if(speed<-20){speed=-20;}
    if(canjump){speed*=friction;}
    hero.x+=speed;