Want to load an Unreal map straight from ActionScript? It's easy!
Next, for a Scrolling List, use:
OR - if you chose to use a drop down menu, use:
Now, add an event listener for the button.
Then, create the map selection handler function:
Finally, add the function that will tell Unreal to load the level.
Save & Publish.
Import the SWF into UDK
In Kismet, you'll need to use OpenGFxMovie to play this movie in your menu level on a player spawn event.
Use your own custom menu class, or the standard GFxMoviePlayer class.
- Add a CLIK Scrolling List (or Drop Down Menu) to the stage, and give it an instance name of 'maplist'.
- Add a CLIK button to the stage, and give it an instance name of 'mapConfirmBtn'.
- Add a new layer and name it 'actions'.
- On the actions layer, enter this code:
Code:
import flash.external.ExternalInterface maplist.dataProvider = ["DM-Deck","VCTF-Necropolis"]; var selectedMap:String;
Code:
maplist.addEventListener("itemPress", this, "HandleItemClick");
Code:
maplist.addEventListener("change", this, "HandleItemClick");
Code:
mapConfirmBtn.addEventListener("press", this, "LoadLevel");
Code:
function HandleItemClick(event:Object) { // use this code for a Scrolling List trace("Scrolling List Selection: " + event.item); selectedMap = event.item; // or use this code for a drop down trace("Drop Down Selection: " + event.data); selectedMap = event.data; }
Code:
function LoadLevel() { var command:String = "open "; command += selectedMap; trace(command); ExternalInterface.call("ConsoleCommand", command); }
Import the SWF into UDK
In Kismet, you'll need to use OpenGFxMovie to play this movie in your menu level on a player spawn event.
Use your own custom menu class, or the standard GFxMoviePlayer class.
Comment