Created
February 12, 2015 12:57
-
-
Save marchbold/42838c3e467200a28918 to your computer and use it in GitHub Desktop.
Display a native picker dialog for user contact selection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Before here we have already requested access and performed the initialisation (as above) | |
| Contacts.service.addEventListener( ContactsEvent.CONTACT_SELECTED, contact_selectedHandler ); | |
| Contacts.service.addEventListener( ContactsEvent.CONTACTPICKER_CANCEL, contacts_contactPickerCancelHandler ); | |
| if (!Contacts.service.showContactPicker()) | |
| { | |
| trace( "Access to contacts list denied by user" ); | |
| } | |
| ... | |
| private function contact_selectedHandler( event:ContactsEvent ):void | |
| { | |
| if (event.data) | |
| { | |
| var contact:Contact = event.data[0]; | |
| trace("Name: " + contact.fullName); | |
| trace("Org: " + contact.organisation.name + " -- " + contact.organisation.title); | |
| for each (var e:Object in contact.emailAddresses) | |
| { | |
| trace(e.label + " -- " + e.value); | |
| } | |
| } | |
| } | |
| private function contacts_contactPickerCancelHandler( event:ContactsEvent ):void | |
| { | |
| trace( "Picker cancelled" ); | |
| } | |
| // com.distriqt.Contacts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment