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?
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.
Sign up to join this communityWe 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");
}
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
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
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");
}
}