Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:Contacts Component for Flash Lite

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

We do not recommend Flash Lite development on current Nokia devices, and all Flash Lite articles on this wiki have been archived. Flash Lite has been removed from all Nokia Asha and recent Series 40 devices and has limited support on Symbian. Specific information for Nokia Belle is available in Flash Lite on Nokia Browser for Symbian. Specific information for OLD Series 40 and Symbian devices is available in the Flash Lite Developers Library.

This document explains how to use Flash Lite Contacts data component and API.

Article Metadata
Created: jaaura (19 May 2009)
Last edited: hamishwillee (13 May 2013)

Note.pngNote: This document has also been published in pdf format inside the Nokia Developer Flash Lite Components package


Introduction to the Contacts component

The Contacts component uses the Nokia Platform Services Contacts API to read and filter a mobile device’s contacts data. The received data is provided in an array of n items, in format {Label, Value}, which is broadcast using the EventDispatcher for all listening objects.



Contacts component is included in the Nokia Developer Flash Lite Components package.


Installation of the Contacts component is easy. Execute the components MXP file and follow the simple instructions in Adobe Extension Manager to complete the installation process. Restart Adobe Flash CS4 after installation.

Note: Component FLA and AS files should appear in the directories [INSTALL PATH]\Flash CS4\en\Configuration\Components\Nokia Developer and [INSTALL PATH]\Flash CS4\en\Configuration\Classes\com\forumnokia. In some setup environments, the files may appear under the wrong language directories (for example, fi instead of en). In such cases, the files should be manually moved to the correct directories as specified above.


  1. Create a Flash Lite Project. Open the Component panel (Ctrl/Apple key + F7) and drag the Contacts component onto the stage. Assign a unique instance name for the object using the properties panel (Ctrl/Apple key + F3). Contacts can now be read using the ActionScript API call getContactsData().


  2. The component sends an event when the contacts data is fully received. For receiving the event and reading, see the section Adding a listener, below.

Skins and assets

The data component does not have any visual elements, except the icon ContactsComponent.png, which is not visible at runtime.

Inspectable parameters

These component parameters can be changed via the Component Inspector panel (Shift + F7). All inspectable parameters can also be controlled via ActionScript with the component APIs.


Parameter Description Value
Filtering Enables filtering to retrieve only certain contact fields, otherwise all contact data is received. By key values / Disabled; default is By key values
Filtered contact fields This value defines which contacts fields (keys) will be received. Only required if filtering is used. Key values are defined in the Supported contact keys section in the Flash Lite Developer’s Library; default is FirstName, LastName
Sorting order Sorting order Ascending/Descending; default is Ascending

Contacts Component ActionScript API

Setting a data filter

public function setFilterValue( key:String ): Void;

This function sets the data filtering according to given key(s), defined in: Supported contact keys section in the Flash Lite Developer’s Library.

Setting the sorting order

public function setSortingOrder( order:String ): Void;

The sorting order can be “Ascending” or “Descending”.

Getting the DataLoad event

public function onReceivedDataEvent(): String;

Returns the event name, which this component will dispatch after receiving data. By default, the name is “onContactsDataLoadEvent”.

Reading contacts data

public function getContactsData(): Void;

Starts reading contacts data using the S60 Platform Service API (uses the asynchronous method for reading), and dispatches an event when the data is read.

Error handling

public function lastError(): Number;

If there was no error in the last call of getContactsData(), the error value is 0.

Error values are defined in the Supported contact keys section in the Flash Lite Developer’s Library.

Note: The returned error value isundefineduntil the component has finished reading data.

Adding a listener

public function addEventListener(event:String, listenerFunction:Object): Void;

The Contacts component dispatches an event when the data is ready. The event can be listened for by creating a listener function and calling the API method addEventListener(). Delegate should be called when specifying the scope in which to run the listening function.

Simple use:

var event_name:String = myContacts.onReceivedDataEvent();
myContacts.addEventListener( event_name, myEventHandler );
function myEventHandler( evt ){
myData = evt.ContactsData;
//handle ContactsData here (refer to Nokia Developer documentation)
// Read the contacts data (myEventHandler gets invoked)

Advanced use:

This example uses Delegate to make sure that the correct event is received here. It also checks for errors and parses the received data.

var event_name:String = myContacts.onReceivedDataEvent();
myContacts.addEventListener( event_name, Delegate.create( this, myEventHandler) );
var receivedItems:Array = [];
function myEventHandler( eventObj:Object ):Void {
switch( eventObj.type )
case event_name:
// Add functionality here
// First check for error
if( myContacts.lastError() == 0 )
for (i = 0; i < eventObj.ContactsData.length; i++)
receivedItems.push( eventObj.ContactsData[i].FirstName + " "
+ eventObj.ContactsData[i].LastName; );
// Copy received data into List UI component
list_mc.populateData( receivedItems );
// Handle the error here
default :
// Read the contacts data (myEventHandler gets invoked)

Removing the listener

public function removeEventListener(event:String, listenerFunction:Object): Void;

Tells the component to stop listening for events.

This page was last modified on 13 May 2013, at 23:43.
31 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.