Unity NEW 4.6 UI Touch Movement

Ok, hello to yo all. I am trying to use the new Ui to make a two buttons to move left and right. I made the jump button very easy, but I can’t figure out how it will work with the movement. I have this function and I want to simply call it when the button is clicked

void OnButtonClicked () {
    if (allowmove == true ) {
        float move = Input.GetAxisRaw ("Horizontal");
	    rigidbody2D.velocity = new Vector2 (move * maxSpeed, rigidbody2D.velocity.y);
    }
}

Fixed your formatting for you. To call a method you simply add it to the OnClick event on the button component.

You must also make the method public.