Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm new to Unreal Development.

In a nutshell, how do I create a button, install it in a basic game, and capture the button click event?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted
  • Send of signals:

We can send messages from flash to UDK with the ActionScript command fscommand( "mycommand" )

For example, we want a button that permit us exit from the game

With ActionScript, we asign the function fscommand("exit") to the click button event

btn_exit.addEventListener( "click", this, "btn_exit_click" );

function btn_exit_click():Void
{
    fscommand("exit");
}
  • Receiving message:

From kismet we can receive the pulsation of the button, for this:

New event -> GFx Ui -> fscommand .

Inside the properties, we have two that are necessary, Movie and FSCommand

On Movie we'll put the flash movie that we are using ( button with green arrow ) and in FSCommand we write the command that we are waiting for, in that case Exit

.

  • Send of signals:

We can connect the exit to that we want to happen when the signal was sended from Flash.

With this example, we are created a "Console Command"

New Action -> Misc -> Console Command

.

share|improve this answer
add comment

The accepted answer is outdated. FScommands are deprecated and slow.

Try using scaleform CLIK and:

event bool WidgetInitialized(name WidgetName, name WidgetPath, GFxObject Widget)
{

    // Determine which widget is being initialized and handle it accordingly
    switch(Widgetname)
    {
        case 'btnStart':
            // Save reference to the label that displays the message to the player
            btnStart = GFxCLIKWidget(Widget);
            btnStart.AddEventListener('CLIK_click', startGame);
            break;

        default:
            // Pass on if not a widget we are looking for
            return Super.WidgetInitialized(Widgetname, WidgetPath, Widget);
    }

    return false;
}

function startGame(EventData data)
{
    // Only on left mouse button
    if(data.mouseIndex == 0)
    {
        ConsoleCommand("open DM-DECK");
    }
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.