CharacterController doesn't work with collider

Hi
I make a 2d game. The Player moves up and I can move him to the left and the right side. Now I want that he can’t move out of the view so I want to create cubes at the left and right sides. But everytime he moves through the cubes.
Here is my movement script:

var moveDirection : Vector3 = Vector3.zero;

function Update () 
{

var controller : CharacterController = GetComponent(CharacterController);

controller.Move(moveDirection*Time.deltaTime);

if(Input.GetKey("d"))
{
   //transform.position = Vector3(transform.position.x+5*Time.deltaTime,transform.position.y,transform.position.z);
}

if(Input.GetKey("a"))
{
   //transform.position = Vector3(transform.position.x-5*Time.deltaTime,transform.position.y,transform.position.z);
}

}

If i remember correctly, your object that uses the character controller has to be a rigidbody