Namespaces
Variants
Actions
Revision as of 07:37, 3 October 2012 by hamishwillee (Talk | contribs)

Archived:Importing landmarks in Flash Lite

Jump to: navigation, search

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.

MultiMediaTile.png
Article Metadata

Code Example
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.png
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

133 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved