UDN
Search public documentation:

GFxAScriptToKismet
日本語訳
中国翻译
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UE3 Home > User Interfaces & HUDs > Scaleform GFx > How to route an external interface call to Kismet

How to route an external interface call to Kismet


Overview


As Scaleform can render to a texture which can then be displayed within the world, it is very useful to be able to call Kismet directly from Actionscript.

ActionScript 2.0 Method


Your Flash button would be setup like this.

ActionScript
on (press)
{
  import flash.external.ExternalInterface;
  ExternalInterface.call("MyUnrealScriptFunction");
}

You can pass as many or as few parameters as you like with an ExternalInterface call (example: ExternalInterface.call("MyFunction", "Matthew", 37, true) passes a string value, an integer, and a boolean). In this case, we aren't passing any. We're just calling the function MyUnrealScriptFunction.

And in your UnrealScript, you would have this:

Unrealscript
class MyMoviePlayer extends GFxMoviePlayer;

//function to receive External Interface call
function MyUnrealScriptFunction()
{
  `log("###### ExternalInterface Call Received #####");
  TriggerRemoteKismetEvent('MyEvent');
}

//function to trigger a remote kismet event
function TriggerRemoteKismetEvent( name EventName )
{
  local array<SequenceObject> AllSeqEvents;
  local Sequence GameSeq;
  local int i;

  GameSeq = GetPC().WorldInfo.GetGameSequence();
  if (GameSeq != None)
  {
    // find any Level Reset events that exist
    GameSeq.FindSeqObjectsByClass(class'SeqEvent_RemoteEvent', true, AllSeqEvents);

    // activate them
    for (i = 0; i < AllSeqEvents.Length; i++)
    {
      if(SeqEvent_RemoteEvent(AllSeqEvents[i]).EventName == EventName)
      {
        SeqEvent_RemoteEvent(AllSeqEvents[i]).CheckActivate(GetPC().WorldInfo, None);
      }
    }
  }
}

Add a Remote Event Kismet node in the level, and give it a name of MyEvent.

Then link that event to whatever you desire to occur.