3
\$\begingroup\$

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?

\$\endgroup\$
5
\$\begingroup\$
  • 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

.

\$\endgroup\$
4
\$\begingroup\$

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");
    }
}
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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