The API components are ready-to-use visual elements that allow you to use API features. The following components are available:
- API Connector
- Flash Ad
- Medal Popup
- Score Browser
- Save Browser
- Vote Bar
Using components in Flash
To use a component, copy and paste the component you'd like to use from the NewgroundsAPI.fla file into your own Flash file. The component will appear where you place it.
Many components have additional settings that you can tweak. To change a component's settings, first select the component on the stage. Be sure no other items are selected. Then:
- In Flash CS4 or lower, click the Window menu, and then select Component Parameters.
- In Flash CS5 or higher, look in the Properties panel under Component Parameters.
The component's settings should appear, and you can freely change them. If you are entering text into a setting (such as API ID), be sure to press Enter when you are finished.
Using components in ActionScript
You can also use the components in ActionScript if you are using a code-based workflow such as FlashDevelop or Flash Builder. For example, the following code will create a Medal Popup component and add it to the stage:
var popup:MedalPopup = new MedalPopup();
You can move or transform the components like any other Sprite
. For example, this code will places the Medal Popup at (200, 200):
popup.x = 200;
popup.y = 200;
Many of the components have additional properties that you can tweak. Check out the API Reference
for a list of the properties in each component.