GUI button image next

can anyone help me, how to create a button and a box and it compose of image and when u press the next button it loads another button… please help me i want it badly. thanks for your cooperation and more power!

Here's the basic idea.

To use this you will have to populate the array of images in the Inspector.

This code draws a texture as a label and then draws a button.

If the button is clicked, the offset into the array of images is incremented.

If it hits the end of the list, it's reset to zero.

This code will cause a bunch of errors if you don't initialize the array of textures.

/* initialize the array of images by using the Inspector.

var imageArray :  Texture2D [];
var currentTex :  int  =  0;

var texRect    :  Rect =  Rect(200, 200, 100, 100);
var buttRect   :  Rect =  Rect(200, 300, 100,  40);

function OnGUI ()
{
    GUI.Label(texRect, imageArray[currentTex]);

    if ( GUI.Button(buttRect, "Next") ) {
        nextImage();
    }
}

function nextImage () : void
{
    currentTex ++;

    if ( currentTex >= imageArray.length ) {
        currentTex = 0;
    }
}

/* initialize the array of images by using the Inspector.

var imageArray :  Texture2D [];
var currentTex :  int  =  0;

var texRect    :  Rect =  Rect(200, 200, 100, 100);
var buttnextRect   :  Rect =  Rect(200, 300, 100,  40);
var buttprevRect   :  Rect =  Rect(200, 400, 100,  40);

function OnGUI ()
{
    GUI.Label(texRect, imageArray[currentTex]);

    if ( GUI.Button(buttnextRect, "Next") ) {
        nextImage();
    }

    if ( GUI.Button(buttprevRect, "Previous") ) {
        previousImage();
    }


}

function nextImage () : void
{
    currentTex ++;

    if ( currentTex >= imageArray.length ) {
        currentTex = 0;
    }
}

function previousImage () : void
{
    currentTex --;

    if ( currentTex == 0 ) {
        currentTex = imageArray.length;
    }
}