This tutorial will walk you through the steps needed to get a working drop down menu in the Scaleform 4/AS3 integration of UDK.
NOTE: This tutorial uses all ActionScript 3 on the timeline of the main Flash file. However, you could also do this in a custom AS3 class instead, or via UnrealScript. This tutorial does not cover those options.
NOTE: This tutorial uses all ActionScript 3 on the timeline of the main Flash file. However, you could also do this in a custom AS3 class instead, or via UnrealScript. This tutorial does not cover those options.
- Create a new AS3 Document.
- Open the file CLIK_Components_AS3.fla found here: C:\UDK\UDK-2012-03\Development\Flash\AS3\CLIK\components\
- Open the Library panel of this file.
- Locate the following components and select them (use CTRL click to select them all):
DefaultDropdownMenu
DefaultListItemRenderer
DefaultScrollingList - Right click and choose Copy.
- Return to your AS3 document, and right click in the Library panel.
- Choose Paste.
- Select the DefaultDropdownMenu and drag it to the stage.
- With the drop down menu on the stage selected, open the Properties panel.
- Give it an instance name of 'mydm' without the single quotes.
- Open the Component Parameters.
- Set the menuRowCount to 10
- Add a new layer, and give that layer the name 'actions'.
- Select the actions layer and open the ActionScript panel.
- Enter the following code:
Code:import scaleform.clik.data.DataProvider; var itemsData:Array = new Array(); for (var i:int = 1; i < 11; i++) { itemsData.push({label:"MyItem " + i, index:i}); } var dp:DataProvider = new DataProvider(itemsData); mydm.dataProvider = dp; mydm.selectedIndex = 0;
- Double click the drop down menu widget on the stage.
- Select the textField.
- On the Properties panel, click the Embed button.
- Select Basic Latin.
- Save the FLA file somewhere.
- Publish the file using the Scaleform Launcher.
Comment