Archived:Importing landmarks in Flash Lite
This code snippet demonstrates how to import landmarks from the file using the Landmarks Platform Service for Flash Lite supported from S60 5th Edition onwards.
Article Metadata
Code Example
Source file: Media:FlashLite Importing Landmarks.zip
Tested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 5th Edition and later
Article
Keywords: Service.Landmarks, landmark.Import()
Created: User:Nokia Developer KB
(26 Jan 2009)
Last edited: hamishwillee
(03 Oct 2012)
Contents |
Preconditions
Note: To import landmarks with this application you need to have copied a landmarks file (landmarks.lmx ) in the folder c:\Data\\Others\ on your device.
Source
// Import Platform Service Interface
import com.nokia.lib.Service;
// Heading of the application
heading_txt.text = "Importing landmarks";
text_txt.text = "Press the Import button to import landmarks from " +
"c:\\Data\\Others\\landmarks.lmx";
// Create new Service object which has Landmark information
var landmark = new Service("Service.Landmarks", "IDataSource");
/**********************************************************
** Function for pressing the Import button.
** Calls Import() method synchronously.
** Method imports landmarks from the file
**********************************************************/
import_mc.onPress = function() {
text_txt.text = "Imported landmarks:\r";
// Define input parameters
var inputData = {
SourceFile:"c:\\Data\\Others\\landmarks.lmx",
MimeType:"application/vnd.nokia.landmarkcollection+xml"
};
var inParams = {Type:"Landmark", Data:inputData};
// Define result value
var outParams = landmark.Import(inParams);
var outList = outParams.ReturnValue;
var i = 0;
if (outParams.ErrorCode == 0) {
var outputEntry = null;
do {
i++;
outputEntry = outList.next();
if (null != outputEntry) {
text_txt.text += "Landmark "+i+"\r"+outputEntry.LandmarkName+
"\r"+outputEntry.id+"\r";
} else {
break;
}
} while (true);
} else {
var errorId = outParams.ErrorCode;
text_txt.text = "Error while importing: "+errorId;
};
};
Postconditions
Imported landmarks are displayed. Landmarks can be imported by pressing the Import button.
Example application
The following sample application has been tested in the Nokia 5800 XpressMusic (S60 5th Edition, Flash Lite 3.0): File:FlashLite Importing Landmarks.zip
See also
- Flash Lite API reference in the Flash Lite Developer's Library
- Exporting landmarks in Flash Lite
- Adding a landmark in Flash Lite
- Modifying landmarks in Flash Lite

