| ID | CS001224 | Creation date | December 15, 2008 |
| Platform | S60 5th Edition | Tested on devices | Nokia 5800 XpressMusic |
| Category | Flash Lite | Subcategory | S60 Platform Services |
| Keywords (APIs, classes, methods, functions): Service.MediaManagement, media.GetList() |
The following code snippet demonstrates how to use the Media Management Service API in a Flash Lite 3.0 application to list media files located on the device (supported from S60 5th Edition onwards).
// Import Platform Service Interface
import com.nokia.lib.Service;
// Heading of the application
heading_txt.text = "List Media files (.jpg)";
// Create a new Service object which has Media Management data
var media = new Service("Service.MediaManagement", "IDataSource");
// Define a filter for wanted files
var filter = {FileType:"Image", Key:"FileExtension", StartRange:".jpg"};
// Define the input parameters
var inParam = {Type:"FileInfo", Filter:filter};
// Define the result data
media.GetList(inParam,callBack);
// Define callback function
function callBack(transactionID:String, eventID:String, outParam:Object) {
if (outParam.ErrorCode == 0) {
var outList = outParam.ReturnValue;
var outputEntry = null;
do {
outputEntry = outList.next();
if (null != outputEntry) {
var filename = outputEntry.FileName;
text_txt.text += "-"+filename+"\r";
} else {
break;
}
} while (true);
} else {
var errorId = outParam.ErrorCode;
text_txt.text = "Error: "+errorId;
}
}
Filenames of the jpg-files are displayed.
The following sample application has been tested in Nokia 5800 XpressMusic (S60 5th edition, Flash Lite 3.0).
File:FlashLite List MediaFiles.zip
No related wiki articles found